若依管理系统根据不同角色展示不同首页
在router目录下,修改index.js文件中将默认路由组件
引入store
import store from '../store'
修改component的返回
{
path: '',
component: Layout,
redirect: 'index',
children: [
{
path: 'index',
name: 'Index',
meta: { title: '首页', icon: 'dashboard', affix: true },
component: () => {
const { roles } = store.getters;
if (roles.includes('admin') || roles.includes('administrator')) {
return import('@/views/index');
} else if (roles.includes('wy_manager') || roles.includes('scope_user_01')) {
return import('@/views/index_v1');
}
}
}
]
}
正文到此结束
- 本文标签: 若依 vue
- 本文链接: https://www.iquanzi.top/article/6
- 版权声明: 本文由张华永原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权