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',
|
});
|
}
|