mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-06 00:49:58 +00:00
fix: disable back button when no back path (#936)
Co-authored-by: 三咲智子 Kevin Deng <sxzz@sxzz.moe>
This commit is contained in:
parent
ba9a91a34e
commit
74148d71b0
1 changed files with 6 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { env } = useBuildInfo()
|
const { env } = useBuildInfo()
|
||||||
|
const router = useRouter()
|
||||||
|
const back = ref(router.options.history.state.back)
|
||||||
|
router.afterEach(() => {
|
||||||
|
back.value = router.options.history.state.back
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -18,7 +23,7 @@ const { env } = useBuildInfo()
|
||||||
{{ $t('app_name') }} <sup text-sm italic text-secondary mt-1>{{ env === 'release' ? 'alpha' : env }}</sup>
|
{{ $t('app_name') }} <sup text-sm italic text-secondary mt-1>{{ env === 'release' ? 'alpha' : env }}</sup>
|
||||||
</div>
|
</div>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<div hidden xl:flex items-center me-8 mt-2>
|
<div hidden xl:flex items-center me-8 mt-2 :class="{ 'pointer-events-none op40': !back }">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
:aria-label="$t('nav.back')"
|
:aria-label="$t('nav.back')"
|
||||||
@click="$router.go(-1)"
|
@click="$router.go(-1)"
|
||||||
|
|
Loading…
Reference in a new issue