forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBackButton.vue
More file actions
34 lines (33 loc) · 804 Bytes
/
BackButton.vue
File metadata and controls
34 lines (33 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<template>
<v-btn
color="default"
:small="$vuetify.breakpoint.smAndDown"
:block="block"
@click="goBack"
>
<v-icon>{{ mdiArrowLeft }}</v-icon>
Go Back
</v-btn>
</template>
<script lang="ts">
import { Vue, Component, Prop } from 'vue-property-decorator'
import { Location } from 'vue-router'
import { mdiArrowLeft } from '@mdi/js'
@Component
export default class BackButton extends Vue {
@Prop({ required: false }) route?: Location
@Prop({ required: false, type: Boolean, default: false }) block!: boolean
mdiArrowLeft = mdiArrowLeft
goBack(): void {
if (this.route) {
this.$router.push(this.route)
return
}
if (window.history.length > 1) {
this.$router.back()
return
}
this.$router.push({ name: 'index' })
}
}
</script>