From 5a681c9bd93a5a1ad1949fe07b47fc583b12ed61 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期日, 19 十月 2025 17:18:06 +0800
Subject: [PATCH] fix: bug
---
apps/bMiniApp/src/hooks/router.ts | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/apps/bMiniApp/src/hooks/router.ts b/apps/bMiniApp/src/hooks/router.ts
index 59447e7..70652a0 100644
--- a/apps/bMiniApp/src/hooks/router.ts
+++ b/apps/bMiniApp/src/hooks/router.ts
@@ -1,15 +1,21 @@
import Taro from '@tarojs/taro';
-import { TabBarPageRouter } from '@/constants';
+import { TabBarPageRouter, TabBarPageRouterList } from '@/constants';
import { useSystemStore } from '@/stores/modules/system';
+import { httpLoggerRecord } from '@12333/utils';
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);
+ });
+ httpLoggerRecord.info({
+ message: `[switchTab]`,
+ args: [option, { index, TabBarPageRouter }],
+ });
};
return switchTab;
}
--
Gitblit v1.9.1