fix: 优化自定义tabBar组件,添加错误处理

- 添加switchTab失败时的redirectTo回退
- 优化样式,添加安全区域适配
This commit is contained in:
H1d3rOne committed 2026-03-07 21:33:10 +08:00
1 parent 7666c8eed6
commit 4f6e3379a3
1 file changed
+7 -1
@@ -65,7 +65,13 @@ export default {
this.currentIndex = index
const path = this.tabList[index].pagePath
uni.switchTab({
url: path
url: path,
fail: (err) => {
console.log('switchTab fail:', err)
uni.redirectTo({
url: path
})
}
})
}
}