zhengyiming
2025-02-17 24dc7ec489cc2206c69ad26b4c931905ad81bd8a
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',
  });
}