1
This commit is contained in:
@@ -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 []
|
||||
|
||||
Reference in New Issue
Block a user