菜单与权限
-
文件目录:app/src/common/menu.js
-
自定义菜单
export const getMenuData = () => formatter(menuData);
可以重定义menuData的获取方式,如:通过rest去获取菜单功能
-
菜单权限(authority代表了功能菜单所需的权限)
{ name: '详情页', icon: 'profile', path: 'profile', children: [ { name: '基础详情页', path: 'basic', }, { name: '高级详情页', path: 'advanced', authority: 'admin', }, ], }
返回菜单以常理形式缓存与后台,返回后每个功能菜单追加上autority属性,这样从性能上或权限控制上来说,都可以推送到前台去决定。
{ name: '详情页', icon: 'profile', path: 'profile', children: [ { name: '基础详情页', path: 'basic', }, { name: '高级详情页', path: 'advanced', authority: ['admin', 'user'], }, ], }
此时“高级详情页”菜单对于admin和user角色均可使用