<el-menu
...
text-color="#fff"
active-text-color="#409EFF"
>
...
</el-menu>
default-active | 当前激活菜单的 index | string | — | — |
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
}
}