fix(tabbar): 修复设置tabbar角标时的潜在越界问题
在设置tabbar角标前添加数组越界检查,防止当idx超出tabbarList范围时报错
This commit is contained in:
@@ -36,7 +36,9 @@ const tabbarStore = reactive({
|
||||
uni.setStorageSync('app-tabbar-index', idx)
|
||||
},
|
||||
setTabbarItemBadge(idx: number, badge: CustomTabBarItemBadge) {
|
||||
tabbarList[idx].badge = badge
|
||||
if (tabbarList[idx]) {
|
||||
tabbarList[idx].badge = badge
|
||||
}
|
||||
},
|
||||
setAutoCurIdx(path: string) {
|
||||
const index = tabbarList.findIndex(item => item.pagePath === path)
|
||||
|
||||
Reference in New Issue
Block a user