zhengyiming
2025-02-13 20619871d0db98f3f298a04e200005e84e0bc6be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import Taro from '@tarojs/taro';
import { TabBarPageRouter } 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));
    console.log('index: ', index);
    systemStore.setTabIndex(index);
    Taro.switchTab(option);
  };
  return switchTab;
}
 
// export function useFirstEnter() {
//   const systemStore = useSystemStore();
//   const { isFirstEnter } = storeToRefs(systemStore);
//   console.log('isFirstEnter: ', isFirstEnter);
 
//   onMounted(() => {
//     systemStore.setIsFirstEnter(false);
//   });
 
//   return { isFirstEnter };
// }