wupengfei
1 天以前 c2463c02a17f92df55ec77ed2da3fb724290c072
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
28
import Taro from '@tarojs/taro';
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 = TabBarPageRouterList.findIndex((x) => option.url.includes(x));
    console.log('index: ', index);
    Taro.switchTab(option).then(() => {
      systemStore.setTabIndex(index);
    });
  };
  return switchTab;
}
 
// export function useFirstEnter() {
//   const systemStore = useSystemStore();
//   const { isFirstEnter } = storeToRefs(systemStore);
//   console.log('isFirstEnter: ', isFirstEnter);
 
//   onMounted(() => {
//     systemStore.setIsFirstEnter(false);
//   });
 
//   return { isFirstEnter };
// }