From 3d7a6f1bb7f8a20c7ff138f6c4c5993979f00e1f Mon Sep 17 00:00:00 2001
From: wupengfei <834520024@qq.com>
Date: 星期一, 20 十月 2025 16:36:59 +0800
Subject: [PATCH] fix: bug
---
apps/cMiniApp/src/hooks/router.ts | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/apps/cMiniApp/src/hooks/router.ts b/apps/cMiniApp/src/hooks/router.ts
index 59447e7..a138cc5 100644
--- a/apps/cMiniApp/src/hooks/router.ts
+++ b/apps/cMiniApp/src/hooks/router.ts
@@ -1,15 +1,16 @@
import Taro from '@tarojs/taro';
-import { TabBarPageRouter } from '@/constants';
+import { TabBarPageRouter, TabBarPageRouterList } from '@/constants';
import { useSystemStore } from '@/stores/modules/system';
export function useSwitchTab() {
const systemStore = useSystemStore();
const switchTab = (option: Taro.switchTab.Option) => {
- const index = Object.values(TabBarPageRouter).findIndex((x) => option.url.includes(x));
+ const index = TabBarPageRouterList.findIndex((x) => option.url.includes(x));
console.log('index: ', index);
- systemStore.setTabIndex(index);
- Taro.switchTab(option);
+ Taro.switchTab(option).then(() => {
+ systemStore.setTabIndex(index);
+ });
};
return switchTab;
}
--
Gitblit v1.9.1