Kaynağa Gözat

fix(tabbar): 修复自定义tabbar启用条件判断

添加customTabbarEnable条件检查,确保仅在启用自定义tabbar时处理鼓包样式
feige996 8 ay önce
ebeveyn
işleme
d77ed8ac29
1 değiştirilmiş dosya ile 4 ekleme ve 4 silme
  1. 4 4
      src/tabbar/store.ts

+ 4 - 4
src/tabbar/store.ts

@@ -1,5 +1,5 @@
 import type { CustomTabBarItem } from './config'
-import { tabbarList as _tabbarList } from './config'
+import { tabbarList as _tabbarList, customTabbarEnable } from './config'
 
 // TODO 1/2: 中间的鼓包tabbarItem的开关
 const BULGE_ENABLE = true
@@ -10,9 +10,9 @@ const tabbarList: CustomTabBarItem[] = _tabbarList.map(item => ({
   pagePath: item.pagePath.startsWith('/') ? item.pagePath : `/${item.pagePath}`,
 }))
 
-if (BULGE_ENABLE) {
-  if (tabbarList.length % 2 === 1) {
-    console.error('tabbar 数量必须是偶数,否则样式很奇怪!!')
+if (customTabbarEnable && BULGE_ENABLE) {
+  if (tabbarList.length % 2) {
+    console.error('有鼓包时 tabbar 数量必须是偶数,否则样式很奇怪!!')
   }
   tabbarList.splice(tabbarList.length / 2, 0, {
     isBulge: true,