fix(tabbar): 修复支付宝平台原生tabbar隐藏问题

在支付宝平台添加onMounted钩子处理原生tabbar隐藏,与微信平台逻辑保持一致
This commit is contained in:
feige996
2025-10-13 20:44:25 +08:00
parent 121be5fd6c
commit 14594dadc6

View File

@@ -39,7 +39,7 @@ function handleClick(index: number) {
uni.navigateTo({ url })
}
}
// #ifndef MP-WEIXIN
// #ifndef MP-WEIXIN || MP-ALIPAY
// 因为有了 custom:true 微信里面不需要多余的hide操作
onLoad(() => {
// 解决原生 tabBar 未隐藏导致有2个 tabBar 的问题
@@ -54,6 +54,21 @@ onLoad(() => {
})
})
// #endif
// #ifdef MP-ALIPAY
onMounted(() => {
// 解决支付宝自定义tabbar 未隐藏导致有2个 tabBar 的问题; 注意支付宝很特别,需要在 onMounted 钩子调用
needHideNativeTabbar
&& uni.hideTabBar({
fail(err) {
console.log('hideTabBar fail: ', err)
},
success(res) {
// console.log('hideTabBar success: ', res)
},
})
})
// #endif
const activeColor = 'var(--wot-color-theme, #1890ff)'
const inactiveColor = '#666'
function getColorByIndex(index: number) {