vue-element-admin 按钮级别的权限判断
vue-element-admin 按钮级别的权限判断
https://panjiachen.github.io/vue-element-admin-site/zh/guide/essentials/permission.html#%E6%8C%87%E4%BB%A4%E6%9D%83%E9%99%90
选用第一种
js 代码:https://github.com/PanJiaChen/vue-element-admin/tree/master/src/directive/permission
注册全局,在main中进行注册
// 权限框架注册全局 import permission from '@/directive/permission/index.js' // 权限判断指令 Vue.use(permission)
在需要的按钮上 加上 权限
v-permission="['admin']"
实例
<el-button v-permission="['admin']">添加</el-button >