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
43 lines (39 loc) · 772 Bytes
/
Copy pathBackButton.vue
File metadata and controls
43 lines (39 loc) · 772 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
35
36
37
38
39
40
41
42
43
<script setup lang="ts">
import { useDisplay } from 'vuetify'
import { mdiArrowLeft } from '@mdi/js'
import type { RouteLocationRaw } from 'vue-router'
const props = withDefaults(
defineProps<{
route?: RouteLocationRaw
block?: boolean
}>(),
{
route: undefined,
block: false,
},
)
const router = useRouter()
const { smAndDown } = useDisplay()
function goBack() {
if (props.route) {
router.push(props.route)
return
}
if (window.history.length > 1) {
router.back()
return
}
router.push({ name: 'index' })
}
</script>
<template>
<v-btn
variant="tonal"
:size="smAndDown ? 'small' : 'default'"
:block="block"
@click="goBack"
>
<v-icon :icon="mdiArrowLeft" start />
Go Back
</v-btn>
</template>