1.在permssion.js里面注释掉 accessedRoutes = arr || 【】
之后加入
//新建数组
var arr = 【】
//进行异步数组过滤
asyncRoutes.forEach((item)=>{
if(item.hasOwnProperty('meta')){
if(item.meta.hasOwnProperty('roles')){
if (item.meta.roles.includes('admin')){
arr.push(item)
}
}
}
})
console.log(asyncRoutes)
accessedRoutes = arr || 【】
2.在官网中,有如图所示代码,
3.实现的效果图