0
点赞
收藏
分享

微信扫一扫

解决菜单不随路由改变而高亮 active-text-color

<el-menu
...
text-color="#fff"
active-text-color="#409EFF"
>
...
</el-menu>

 

default-active当前激活菜单的 indexstring

 

select菜单激活回调index: 选中菜单项的 index, indexPath: 选中菜单项的 index path
<el-menu
    :default-active="$route.path"
    ...
    text-color="#fff"
    @select="handleSelect"
    active-text-color="#409EFF"
></el-menu>
// ....
data () {
  return {
    // ...
    activeIndex: ''
  }
},
watch: {
  $route () {
    this.handleSelect(this.activeIndex)
  }
},
methods: {
  // ...
  handleSelect (index) {
    this.activeIndex = index
  }
}
举报

相关推荐

0 条评论