权限控制逻辑
一个用户可以拥有多个role
1.获取用户的roles
2.删除路由
3.删除菜单
权限分类
-
登录权限
路由全局钩子,每进入路由判断有无token, 无则登录获取token -
菜单权限
有token,如果无role,则getUserInfo
1. 拿着token从接口动态获取 这个用户role列表:
2. 裁剪路由 this.$route.options渲染菜单
1.指令 v-permission直接放在元素上
2.全局函数
el-tab是根据v-if条件显示的
v-permission不能充当v-if条件 因此封装一个全局函数