This commit is contained in:
Ghost
2026-04-27 14:36:52 +08:00
parent 6d5572108d
commit 59419c4ce9
7 changed files with 100 additions and 44 deletions

View File

@@ -146,8 +146,16 @@ Page({
onShow() {
const { redirectIfMiniprogramAudit } = require('../../utils/miniprogramAuditGate.js')
if (redirectIfMiniprogramAudit()) return
const tb = typeof this.getTabBar === 'function' ? this.getTabBar() : null
if (tb && typeof tb.updateSelected === 'function') tb.updateSelected()
try {
const tb = typeof this.getTabBar === 'function' ? this.getTabBar() : null
if (tb && typeof tb.updateSelected === 'function') {
tb.updateSelected()
} else {
const c = typeof this.selectComponent === 'function' ? this.selectComponent('#custom-tab-bar') : null
if (c && typeof c.refreshFromConfig === 'function') c.refreshFromConfig()
else if (c && typeof c.updateSelected === 'function') c.updateSelected()
}
} catch (e) {}
const app = getApp()
try {
const st = wx.getStorageSync('token')

View File

@@ -3,5 +3,7 @@
"navigationBarBackgroundColor": "#faf9ff",
"navigationBarTextStyle": "black",
"backgroundColor": "#f4f3f9",
"usingComponents": {}
"usingComponents": {
"custom-tab-bar": "/custom-tab-bar/index"
}
}

View File

@@ -132,4 +132,7 @@
</button>
</view>
</view>
<!-- 非 app.json Tab 页时 getTabBar 可能不可用onShow 内用 selectComponent('#custom-tab-bar') 同步选中态 -->
<custom-tab-bar id="custom-tab-bar" />
</view>