This commit is contained in:
van
2026-03-11 21:56:24 +08:00
parent 2b9e1aef3f
commit bc33717921
2 changed files with 54 additions and 108 deletions

View File

@@ -10,9 +10,10 @@
<app-main/>
<settings ref="settingRef"/>
</div>
<!-- 移动端底部导航 -->
<!-- 移动端底部导航key 随接口路由更新确保菜单与跳转使用最新路由 -->
<mobile-bottom-nav
v-if="device === 'mobile'"
:key="mobileNavKey"
:items="mobileNavItems"
/>
</div>
@@ -46,6 +47,13 @@ export default {
fixedHeader: state => state.settings.fixedHeader
}),
...mapGetters(['sidebarRouters']),
/** 接口路由更新后变化,使底部导航重新渲染并拉取最新菜单,避免点击跳错页 */
mobileNavKey() {
const routes = this.sidebarRouters || []
const len = routes.length
const firstPath = (len && routes[0]) ? (routes[0].path || '') : ''
return `${len}-${firstPath}`
},
mobileNavItems() {
// 如果返回空数组,组件会使用默认逻辑从路由中自动获取所有可用路由
return []