From b184adc9a33ce7a27898c9a313b287d4473a3ebe Mon Sep 17 00:00:00 2001 From: feige996 <1020102647@qq.com> Date: Sun, 24 Aug 2025 12:51:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(tabbar):=20=E4=BF=AE=E5=A4=8D=E6=9C=AA?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E8=B7=AF=E7=94=B1=E6=97=B6=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=AC=AC=E4=B8=80=E4=B8=AA=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当当前页面路由不在标签栏配置中时,检查是否在页面栈中存在匹配路由,避免直接选中第一个标签 --- src/tabbar/store.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tabbar/store.ts b/src/tabbar/store.ts index 042582f..7ac71db 100644 --- a/src/tabbar/store.ts +++ b/src/tabbar/store.ts @@ -40,7 +40,13 @@ const tabbarStore = reactive({ console.log('index:', index, path) // console.log('tabbarList:', tabbarList) if (index === -1) { - this.setCurIdx(0) + const pagesPathList = getCurrentPages().map(item => item.route.startsWith('/') ? item.route : `/${item.route}`) + // console.log(pagesPathList) + const flag = tabbarList.some(item => pagesPathList.includes(item.pagePath)) + if (!flag) { + this.setCurIdx(0) + return + } } else { this.setCurIdx(index)