最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Vue 配合eiement动态路由,权限验证的方法
时间:2022-06-25 15:36:20 编辑:袖梨 来源:一聚教程网
1.要实现动态路由,只需要在main.js中将所有路由表先规定好,如下
const routes=[
{path:'/login',component:login},/*登录*/
{path:'/home',component:home},/*首页*/
{path:'/monitor',component:monitor},/*实时监控*/
{path: "/orderQuery", component: orderQuery},/*电子围栏*/
{path: "/fenceSet", component: fenceSet},/*电子围栏*/
{path:'/orderCenter',component:orderCenter},/*订单中心*/
{path:'/carctlExamine',component:carctlExamine},/*车管员审批*/
{path:'/partExamine',component:partExamine},/*部门领导审批*/
{path:'/vpExamine',component:vpExamine},/*副总审批*/
{path:'/distribute',component:distribute},/*调度派单*/
{path:'/receipt',component:receipt},/*回执*/
{path:'/trajectory',component:trajectory},/*轨迹回放*/
{path:'/statistics',component:statistics },/*统计*/
{path:'/car',component:car},/*车辆管理*/
{path:'/user',component:user},/*用户管理*/
{path:'/equipment',component:equipment},/*设备管理*/
{path:'/group',component:group},/*小组维护*/
{path:'/driver',component:driver},/*驾驶员管理*/
{path: '/company', component: company},/*公司管理*/
{path: '/adminManage', component: adminManage},/*公司员管理*/
{path: '/roleManage', component: roleManage},/*角色管理*/
{path:'/systemDaily',component:systemDaily },/*系统日志*/
];
2.把前端路由表发给后台和后台协商返回的数据形式,在app.vue中,使用《el=menu》循环出来后台返回的路由表如下
/*一级导航*/ {{item.name}} {{item.name}} /*二级导航*/ {{child.name}} {{child.name}} /*若存在三级导航*/ {{three.name}}
这样就可以在登录的时候根据接口获取到当前用户所拥有的权限以及路由表,这样动态路由就做好了 。我们是根据页面来确定权限的,没有页面就代表没有权限无法查看页面。
相关文章
- Yandex网页版访问入口 Yandex搜索引擎官网登录 10-26
- AI漫剧伪装直男1‑24集无雾版夸克网盘资源免费分享 10-26
- 韩漫在线免费漫画入口-最新韩漫免费阅读入口 10-26
- 海角社区最新登录入口-2026海角官网在线登录直达地址 10-26
- mcjs网页版即点即玩-mcjs极速秒玩入口 10-23
- 超星学习通网页版登录-超星学习通官网入口 10-23