高亮就是 :default-active="State"这个属性,但是我们不能写死,像我一样写成属性绑定,然后再data里面初始化State,就 ' ' 就好,然后我们后端是有path字段的,然后再子菜单上定义一个点击事件
menuState() {
// window.sessionStorage.setItem("activePath", activePath);
this.State = this.$route.path;
},
然后再监听属性里面,在里面监听路由
watch:{
$route:'menuState'
}
最后还有一步,再create钩子函数里面写
this.State = this.$route.path;
大功告成,还没发现什么bug