refactor(tabbar): 使用reactive包装tabbarList以提高响应性

This commit is contained in:
feige996
2025-08-24 16:22:34 +08:00
parent eafd3a9f30
commit a51e9fb8dc
2 changed files with 5 additions and 3 deletions

View File

@@ -57,7 +57,7 @@ function gotoTabbar() {
}
// #region setTabbarBadge
function setTabbarBadge() {
tabbarStore.setTabbarItemBadge(3, 10)
tabbarStore.setTabbarItemBadge(1, 10)
}
// #endregion
</script>

View File

@@ -1,14 +1,16 @@
import type { CustomTabBarItem, CustomTabBarItemBadge } from './config'
import { reactive } from 'vue'
import { tabbarList as _tabbarList, customTabbarEnable } from './config'
// TODO 1/2: 中间的鼓包tabbarItem的开关
const BULGE_ENABLE = false
/** tabbarList 里面的 path 从 pages.config.ts 得到 */
const tabbarList: CustomTabBarItem[] = _tabbarList.map(item => ({
const tabbarList = reactive<CustomTabBarItem[]>(_tabbarList.map(item => ({
...item,
pagePath: item.pagePath.startsWith('/') ? item.pagePath : `/${item.pagePath}`,
}))
})))
if (customTabbarEnable && BULGE_ENABLE) {
if (tabbarList.length % 2) {