|
|
@@ -1,18 +1,14 @@
|
|
|
<script setup lang="ts">
|
|
|
// 'i-carbon-code',
|
|
|
-import { tabbarList as _tabBarList, cacheTabbarEnable, selectedTabbarStrategy, TABBAR_MAP } from './config'
|
|
|
+import { tabbarList as _tabBarList, customTabbarEnable, nativeTabbarNeedHide, tabbarCacheEnable } from './config'
|
|
|
import { tabbarStore } from './store'
|
|
|
|
|
|
-const customTabbarEnable
|
|
|
-= selectedTabbarStrategy === TABBAR_MAP.CUSTOM_TABBAR_WITH_CACHE
|
|
|
- || selectedTabbarStrategy === TABBAR_MAP.CUSTOM_TABBAR_WITHOUT_CACHE
|
|
|
-
|
|
|
/** tabbarList 里面的 path 从 pages.config.ts 得到 */
|
|
|
const tabbarList = _tabBarList.map(item => ({ ...item, path: `/${item.pagePath}` }))
|
|
|
function selectTabBar({ value: index }: { value: number }) {
|
|
|
const url = tabbarList[index].path
|
|
|
tabbarStore.setCurIdx(index)
|
|
|
- if (cacheTabbarEnable) {
|
|
|
+ if (tabbarCacheEnable) {
|
|
|
uni.switchTab({ url })
|
|
|
}
|
|
|
else {
|
|
|
@@ -21,8 +17,7 @@ function selectTabBar({ value: index }: { value: number }) {
|
|
|
}
|
|
|
onLoad(() => {
|
|
|
// 解决原生 tabBar 未隐藏导致有2个 tabBar 的问题
|
|
|
- const hideRedundantTabbarEnable = selectedTabbarStrategy === TABBAR_MAP.CUSTOM_TABBAR_WITH_CACHE
|
|
|
- hideRedundantTabbarEnable
|
|
|
+ nativeTabbarNeedHide
|
|
|
&& uni.hideTabBar({
|
|
|
fail(err) {
|
|
|
console.log('hideTabBar fail: ', err)
|