| | |
| | | import Taro from '@tarojs/taro'; |
| | | import { TabBarPageRouter } from '@/constants'; |
| | | import { useSystemStore } from '@/stores/modules/system'; |
| | | import { useAppStore } from '@/stores/modules/app'; |
| | | import { isInAlipay } from '@/utils/env'; |
| | | |
| | | export function useSwitchTab() { |
| | | const systemStore = useSystemStore(); |
| | |
| | | isFocus, |
| | | }; |
| | | } |
| | | |
| | | export function useTabRouteEnhance() { |
| | | const appStore = useAppStore(); |
| | | const { latestRoute } = storeToRefs(appStore); |
| | | |
| | | const router = Taro.useRouter(); |
| | | |
| | | Taro.useDidShow(() => { |
| | | const isTabbarPage = Object.values(TabBarPageRouter).some((x) => |
| | | latestRoute.value.toLowerCase().includes(x.toLowerCase()) |
| | | ); |
| | | if (isTabbarPage && isInAlipay) { |
| | | Taro.reLaunch({ |
| | | url: router.path, |
| | | success() { |
| | | appStore.setLatestRoute(''); |
| | | }, |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | Taro.useDidHide(() => { |
| | | appStore.setLatestRoute(router.path); |
| | | }); |
| | | } |