wupengfei
2025-02-11 61556a945a1a90e1c97bb2f7e1f990cd09de4318
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
import { TabBarPageRouter } from '@/constants';
import Taro from '@tarojs/taro';
import { useSystemStoreWithOut } from '@/stores/modules/system';
 
export function goBack(delta = 1) {
  const pages = Taro.getCurrentPages();
 
  const systemStore = useSystemStoreWithOut();
 
  if (pages.length > 1) {
    Taro.navigateBack({ delta: delta });
  } else {
    Taro.switchTab({
      url: Object.values(TabBarPageRouter)[systemStore.activeTab],
    });
  }
}
 
export function goHome() {
  const systemStore = useSystemStoreWithOut();
  systemStore.setTabIndex(0);
  Taro.switchTab({
    url: '/pages/home/index',
  });
}