elementUI 页面刷新菜单定位

el-menu  有个属性 :default-active="curActive"  this

el-menu-item 有个属性 :index=“home”路由

这2个属性值对上号就自动定位了it

data() {
  return {
    curActive:"home"
  };
},io

能够在左侧菜单栏组件里对路由进行监控,就算切换tagview也会自动定位监控

watch: {
  '$route' (to, from) {
    this.curActive = this.$store.state.curPage
  }
}route

相关文章
相关标签/搜索