import Taro from '@tarojs/taro';
|
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 = TabBarPageRouterList.findIndex((x) => option.url.includes(x));
|
console.log('index: ', index);
|
systemStore.setTabIndex(index);
|
Taro.switchTab(option);
|
httpLoggerRecord.info({
|
message: `[switchTab]`,
|
args: [option, { index, TabBarPageRouter }],
|
});
|
};
|
return switchTab;
|
}
|
|
// export function useFirstEnter() {
|
// const systemStore = useSystemStore();
|
// const { isFirstEnter } = storeToRefs(systemStore);
|
// console.log('isFirstEnter: ', isFirstEnter);
|
|
// onMounted(() => {
|
// systemStore.setIsFirstEnter(false);
|
// });
|
|
// return { isFirstEnter };
|
// }
|