|
@@ -3,6 +3,7 @@ import { tabbarStore } from './tabbar'
|
|
|
// 'i-carbon-code',
|
|
// 'i-carbon-code',
|
|
|
import { tabbarList as _tabBarList, cacheTabbarEnable, selectedTabbarStrategy } from './tabbarList'
|
|
import { tabbarList as _tabBarList, cacheTabbarEnable, selectedTabbarStrategy } from './tabbarList'
|
|
|
|
|
|
|
|
|
|
+// @ts-expect-error 预知的判断
|
|
|
const customTabbarEnable = selectedTabbarStrategy === 1 || selectedTabbarStrategy === 2
|
|
const customTabbarEnable = selectedTabbarStrategy === 1 || selectedTabbarStrategy === 2
|
|
|
/** tabbarList 里面的 path 从 pages.config.ts 得到 */
|
|
/** tabbarList 里面的 path 从 pages.config.ts 得到 */
|
|
|
const tabbarList = _tabBarList.map(item => ({ ...item, path: `/${item.pagePath}` }))
|
|
const tabbarList = _tabBarList.map(item => ({ ...item, path: `/${item.pagePath}` }))
|
|
@@ -18,6 +19,7 @@ function selectTabBar({ value: index }: { value: number }) {
|
|
|
}
|
|
}
|
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
|
// 解决原生 tabBar 未隐藏导致有2个 tabBar 的问题
|
|
// 解决原生 tabBar 未隐藏导致有2个 tabBar 的问题
|
|
|
|
|
+ // @ts-expect-error 预知的判断
|
|
|
const hideRedundantTabbarEnable = selectedTabbarStrategy === 1
|
|
const hideRedundantTabbarEnable = selectedTabbarStrategy === 1
|
|
|
hideRedundantTabbarEnable
|
|
hideRedundantTabbarEnable
|
|
|
&& uni.hideTabBar({
|
|
&& uni.hideTabBar({
|
|
@@ -34,18 +36,15 @@ onLoad(() => {
|
|
|
<template>
|
|
<template>
|
|
|
<wd-tabbar
|
|
<wd-tabbar
|
|
|
v-if="customTabbarEnable"
|
|
v-if="customTabbarEnable"
|
|
|
-
|
|
|
|
|
v-model="tabbarStore.curIdx"
|
|
v-model="tabbarStore.curIdx"
|
|
|
-
|
|
|
|
|
- bordered safeareainsetbottom placeholder fixed
|
|
|
|
|
|
|
+ bordered
|
|
|
|
|
+ safeareainsetbottom
|
|
|
|
|
+ placeholder
|
|
|
|
|
+ fixed
|
|
|
@change="selectTabBar"
|
|
@change="selectTabBar"
|
|
|
>
|
|
>
|
|
|
<block v-for="(item, idx) in tabbarList" :key="item.path">
|
|
<block v-for="(item, idx) in tabbarList" :key="item.path">
|
|
|
- <wd-tabbar-item
|
|
|
|
|
- v-if="item.iconType === 'wot'"
|
|
|
|
|
- :title="item.text"
|
|
|
|
|
- :icon="item.icon"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <wd-tabbar-item v-if="item.iconType === 'wot'" :title="item.text" :icon="item.icon" />
|
|
|
<wd-tabbar-item
|
|
<wd-tabbar-item
|
|
|
v-else-if="item.iconType === 'unocss' || item.iconType === 'iconfont'"
|
|
v-else-if="item.iconType === 'unocss' || item.iconType === 'iconfont'"
|
|
|
:title="item.text"
|
|
:title="item.text"
|