refactor(tabbar): 将自定义标签栏列表移至 store 并重构相关逻辑

将 customTabbarList 从 config.ts 移动到 store.ts 中定义
在 tabbarStore 中添加 tabbarList 状态
更新 index.vue 使用 store 中的 tabbarList 替代直接导入
This commit is contained in:
feige996
2025-08-15 16:41:03 +08:00
parent ede06b367d
commit 4e1ea8b6cb
3 changed files with 55 additions and 54 deletions

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
// 'i-carbon-code',
import { customTabbarList as _tabBarList, customTabbarEnable, nativeTabbarNeedHide, tabbarCacheEnable } from './config'
import { customTabbarEnable, nativeTabbarNeedHide, tabbarCacheEnable } from './config'
import { tabbarStore } from './store'
// #ifdef MP-WEIXIN
@@ -20,7 +20,7 @@ function handleClickBulge() {
}
/** tabbarList 里面的 path 从 pages.config.ts 得到 */
const tabbarList = _tabBarList.map(item => ({ ...item, path: `/${item.pagePath}` }))
const tabbarList = tabbarStore.tabbarList.map(item => ({ ...item, path: `/${item.pagePath}` }))
if (BULGE_ENABLE) {
if (tabbarList.length % 2 === 1) {
console.error('tabbar 数量必须是偶数,否则样式很奇怪!!')