1.左侧菜单栏,默认选中
element-ui侧边栏实现路由跳转
关键代码:
在<el-menu>中需要--:default-active="this.$route.path"。用来绑定路由表
在<el-menu>中需要--router------或者router=true
<el-menu :default-active="this.$route.path" router>
<el-submenu index="2">
<template slot="title"><i class="el-icon-menu"></i>导航</template>
<el-menu-item index="/mytopic">我的题目</el-menu-item>
<el-menu-item index="/myexam">我的试卷</el-menu-item>
<el-menu-item index="/myrepo">我的试卷库</el-menu-item>
<el-menu-item index="/mytest">我的考试记录</el-menu-item>
</el-submenu>
</el-menu>
例如
登录系统后,根据跳转的路径自己默认选中打开