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