fix: 404.vue routing return problem (#78)

This commit is contained in:
ljt990218 2024-03-30 17:12:02 +08:00 committed by GitHub
parent 8231b628b5
commit e234476d7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,12 @@
<script setup lang="ts">
const router = useRouter()
function onBack() {
if (window.history.state.back)
history.back()
else
router.replace('/')
}
</script>
<template>
@ -9,7 +16,7 @@ const router = useRouter()
<RouterView />
<div class="mt-10">
<button van-haptics-feedback btn m="3 t8" @click="router.back()">
<button van-haptics-feedback btn m="3 t8" @click="onBack">
Back
</button>
</div>