element ui 页面 刷新时侧边栏保持当前选中

 

<el-menu
:default-openeds="defaultOpeneds"
class="el-menu-vertical-demo"
unique-opened
menu-trigger="hover"
background-color="#FFF"
text-color="#000"
active-text-color="#FFF"
router :default-active="currentMenu"
@open="open"
>

</el-menu>

this.navConfig = [  // 为导航中所有的路由数据
{index:'1',path:[
'/studentManagement',
'/order','/jurisdiction',
'/billingType',
'/singleQuantitySetting',
'/productSettings',
'/studentSourceSetting',
'/signingMethod',
'/preferentialActivities',
'/collectionAccount',
'/stagingPlatform',
'/studentGrade',
'/studentStatus',
'/accountSet',
'/roleSet'
]},
];
let thisNav = this.navConfig.find(item =>{
return item.path.includes(path);
});
if(thisNav){
this.defaultOpeneds = [thisNav.index]
}else{
if(localStorage.getItem('finance_token')){
this.$router.push({
path:'/order'
})
}
}

 

页面刷新时保持当前选择

posted @ 2021-04-04 16:57  蒜泥茄子  阅读(476)  评论(0编辑  收藏  举报