fix: Add `route.name` null check (#132)
This commit is contained in:
parent
d750a2afb9
commit
0658a01342
|
|
@ -1,4 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { routeWhiteList } from '@/config/routes'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
|
|
@ -18,9 +20,7 @@ const title = computed(() => {
|
|||
return route.meta.i18n ? t(route.meta.i18n) : (route.meta.title || '')
|
||||
})
|
||||
|
||||
const routeWhiteList = ['home', 'profile']
|
||||
|
||||
const showLeftArrow = computed(() => routeWhiteList.includes(route.name))
|
||||
const showLeftArrow = computed(() => route.name && routeWhiteList.includes(route.name))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<script setup lang="ts">
|
||||
import { routeWhiteList } from '@/config/routes'
|
||||
|
||||
const { t } = useI18n()
|
||||
const active = ref(0)
|
||||
const route = useRoute()
|
||||
|
||||
const routeWhiteList = ['home', 'profile']
|
||||
|
||||
const show = computed(() => routeWhiteList.includes(route.name))
|
||||
const show = computed(() => route.name && routeWhiteList.includes(route.name))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
// 定义导航栏和标签栏可见的路由白名单
|
||||
export const routeWhiteList: readonly string[] = [
|
||||
'home', // 首页
|
||||
'profile', // 个人中心
|
||||
]
|
||||
Loading…
Reference in New Issue