zhengyiming
2025-02-13 52e3cfc5c8267a079ed0d3c32758124fc74ea8ea
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',
  });
}