el-menu 有個屬性 :default-active="curActive"
el-menu-item 有個屬性 :index=“home”
這2個屬性值對上號就自動定位了
data() {
return {
curActive:"home"
};
},
可以在左側菜單欄組件里對路由進行監控,就算切換tagview也會自動定位
watch: {
'$route' (to, from) {
this.curActive = this.$store.state.curPage
}
}