fix: 🐛 修复商家端菜单切换之后active样式丢失问题
parent
74b180f6d3
commit
8c9246faa4
|
@ -360,6 +360,11 @@ util.initRouter = function (vm) { // 初始化路由
|
|||
// 缓存数据 修改加载标识
|
||||
window.localStorage.setItem('menuData', JSON.stringify(menuData));
|
||||
vm.$store.commit('setAdded', true);
|
||||
if(vm.$store.state.app.refMenu){
|
||||
vm.$nextTick(()=>{
|
||||
vm.$store.state.app.refMenu.updateActiveName();
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
};
|
||||
|
|
|
@ -40,9 +40,13 @@ const app = {
|
|||
tagsList: [...otherRouter.children],
|
||||
messageCount: 0,
|
||||
// 在这里定义你不想要缓存的页面的name属性值(参见路由配置router.js)
|
||||
dontCache: ['test', 'test']
|
||||
dontCache: ['test', 'test'],
|
||||
refMenu:""
|
||||
},
|
||||
mutations: {
|
||||
childrenMenu(state,v){
|
||||
state.refMenu = v
|
||||
},
|
||||
// 动态添加主界面路由,需要缓存
|
||||
updateAppRouter(state, routes) {
|
||||
state.routers.push(...routes);
|
||||
|
|
|
@ -33,6 +33,7 @@ import util from "@/libs/util.js";
|
|||
export default {
|
||||
name: "shrinkableMenu",
|
||||
computed: {
|
||||
|
||||
// 二级菜单列表
|
||||
menuList() {
|
||||
return this.$store.state.app.menuList;
|
||||
|
@ -63,12 +64,10 @@ export default {
|
|||
});
|
||||
},
|
||||
selectNav(name) { // 一级路由点击
|
||||
this.$store.commit("childrenMenu",this.$refs.childrenMenu)
|
||||
this.$store.commit("setCurrNav", name);
|
||||
this.setStore("currNav", name);
|
||||
util.initRouter(this);
|
||||
this.$nextTick(()=>{
|
||||
this.$refs.childrenMenu.updateActiveName()
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue