vue-element-admin how to hide route from admin? roles:['editor'] seemly not working

oxcyiej7  于 22天前  发布在  其他
关注(0)|答案(1)|浏览(20)

Question(提问)

Steps to reproduce(问题复现步骤)
Screenshot or Gif(截图或动态图)
Other relevant information(格外信息)
  • Your OS:
  • Node.js version:
  • vue-element-admin version:
b4lqfgs4

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

相关问题