fix: guard avatar entry and hide chat navigation
This commit is contained in:
@@ -39,13 +39,19 @@ const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const currentRoute = ref<string>(route.path)
|
||||
const showNav = ref<boolean>(true)
|
||||
const showNav = ref<boolean>(shouldShowNav(route.path))
|
||||
|
||||
function shouldShowNav(path: string) {
|
||||
return path !== '/'
|
||||
&& path !== '/login/sms'
|
||||
&& !path.startsWith('/avatar/edit')
|
||||
&& !path.startsWith('/avatar/chat')
|
||||
}
|
||||
|
||||
// 监听路由变化
|
||||
watch(() => route.path, (newPath) => {
|
||||
currentRoute.value = newPath
|
||||
// 首页(创建引导)与编辑页隐藏底部导航
|
||||
showNav.value = newPath !== '/' && !newPath.startsWith('/avatar/edit')
|
||||
showNav.value = shouldShowNav(newPath)
|
||||
})
|
||||
|
||||
// 导航
|
||||
@@ -55,7 +61,7 @@ const navigateTo = (path: string) => {
|
||||
|
||||
onMounted(() => {
|
||||
currentRoute.value = route.path
|
||||
showNav.value = route.path !== '/' && !route.path.startsWith('/avatar/edit')
|
||||
showNav.value = shouldShowNav(route.path)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user