set src\router\index.js 26: roles: ['admin','editor'] control the page roles (you can set multiple roles)
get src\permission.js // get user info // note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
As long as the elements in the obtained identity array can be found in the configured routing roles array, they can be accessed, otherwise they cannot. Of course, if no roles are configured for the route, everyone can access it
1条答案
按热度按时间b4lqfgs41#
set
src\router\index.js 26:
roles: ['admin','editor'] control the page roles (you can set multiple roles)
get
src\permission.js
// get user info
// note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
As long as the elements in the obtained identity array can be found in the configured routing roles array, they can be accessed, otherwise they cannot. Of course, if no roles are configured for the route, everyone can access it