From 6b5e2f9d0bb4c865d130c458585a956ab7e227e9 Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Mon, 15 Sep 2025 16:05:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(tabbar):=20=E4=BF=AE=E5=A4=8D=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E8=B7=AF=E5=BE=84=E4=B8=BA'/'=E6=97=B6tabbar=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 处理本地'/pages/index/index'和线上'/'路径不一致导致的tabbar显示问题 --- src/App.ku.vue | 9 ++++++++- src/tabbar/store.ts | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/App.ku.vue b/src/App.ku.vue index 9dc4d28..8aab489 100644 --- a/src/App.ku.vue +++ b/src/App.ku.vue @@ -11,7 +11,14 @@ const isCurrentPageTabbar = ref(true) onShow(() => { console.log('App.ku.vue onShow', currRoute()) const { path } = currRoute() - isCurrentPageTabbar.value = isPageTabbar(path) + // “蜡笔小开心”提到本地是 '/pages/index/index',线上是 '/' 导致线上 tabbar 不见了 + // 所以这里需要判断一下,如果是 '/' 就当做首页,也要显示 tabbar + if (path === '/') { + isCurrentPageTabbar.value = true + } + else { + isCurrentPageTabbar.value = isPageTabbar(path) + } }) const helloKuRoot = ref('Hello AppKuVue') diff --git a/src/tabbar/store.ts b/src/tabbar/store.ts index 7919cc0..839bc61 100644 --- a/src/tabbar/store.ts +++ b/src/tabbar/store.ts @@ -45,6 +45,11 @@ const tabbarStore = reactive({ } }, setAutoCurIdx(path: string) { + // '/' 当做首页 + if (path === '/') { + this.setCurIdx(0) + return + } const index = tabbarList.findIndex(item => item.pagePath === path) FG_LOG_ENABLE && console.log('index:', index, path) // console.log('tabbarList:', tabbarList)