方式一:当你的路由模式为hash模式时:
mounted() {
// activeIndex最终绑定给<el-menu :default-active="activeIndex">
this.activeIndex = window.location.href.split('#')[1];
}
方式二: 当你的路由模式为history模式时:
mounted() {
// activeIndex最终绑定给<el-menu :default-active="activeIndex">
this.activeIndex = window.location.pathname;
}