解决前图片:
解决方法: 在嵌入菜单的组件中添加路由监听
select(m){
this.menuList.forEach(element => {
if(element.children.length > 0){
element.children.forEach(child =>{
if(child.path == m){
this.selectMenu = child;
return;
}
})
}
});
this.$router.push(this.selectMenu.path);
this.childActiveMenu = this.selectMenu.path;
this.breadcrumbData.splice(0,1,this.selectMenu);
},
watch:{
$route(to, from) {
this.select(to.path);
},
parentActiveMenu() {
this.$nextTick(() => {
this.$refs.side_menu.updateOpened();
this.$refs.side_menu.updateActiveName();
})
},
'$store.state.users.routers':function(){
this.initMenuData();
},
}
解决后图片: