亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Vue 配合eiement動態(tài)路由,權限驗證的方法

 更新時間:2018年09月26日 14:07:32   作者:愛吃排骨  
今天小編就為大家分享一篇Vue 配合eiement動態(tài)路由,權限驗證的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

1.要實現動態(tài)路由,只需要在main.js中將所有路由表先規(guī)定好,如下

const routes=[
 {path:'/login',component:login},/*登錄*/
 
 {path:'/home',component:home},/*首頁*/
 {path:'/monitor',component:monitor},/*實時監(jiān)控*/
 {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},/*回執(zhí)*/
 
 {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.把前端路由表發(fā)給后臺和后臺協商返回的數據形式,在app.vue中,使用《el=menu》循環(huán)出來后臺返回的路由表如下

 <el-menu
  :default-active="$route.path"
  class="el-menu-demo"
  mode="horizontal"
  @select="handleSelect"
  background-color="#545c64"
  text-color="#fff"
  active-text-color="#85ffca">
 
  <el-menu-item :index="item.path" v-for="item in pathList"
      v-if="item.path!=null" :key="item.id" >
  <router-link :to="item.path">{{item.name}}</router-link>
  </el-menu-item>/*一級導航*/
 
  <el-submenu v-if="item.path==null" :key="item.id":index="item.name" v-for="item in pathList">
  <template slot="title">{{item.name}}</template>
 
  <el-menu-item v-for="child in item.children" :index="child.path"
   :key="child.id" v-if="child.path!=null" >/*二級導航*/
   <router-link :to="child.path">{{child.name}}</router-link>
 
  </el-menu-item>
  <el-submenu v-if="child.children!=[]&&child.path==null" v-for="child in item.children":key="child.id":index="child.name" >
   <template slot="title">{{child.name}}</template>
   <el-menu-item v-for="three in child.children":index="three.path":key="three.id">/*若存在三級導航*/
   <router-link :to="three.path">{{three.name}}</router-link>
   </el-menu-item>
  </el-submenu>
 
  </el-submenu>
 
 </el-menu>

這樣就可以在登錄的時候根據接口獲取到當前用戶所擁有的權限以及路由表,這樣動態(tài)路由就做好了 。我們是根據頁面來確定權限的,沒有頁面就代表沒有權限無法查看頁面。

以上這篇Vue 配合eiement動態(tài)路由,權限驗證的方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關文章

  • 在Vue項目中引入騰訊驗證碼服務的教程

    在Vue項目中引入騰訊驗證碼服務的教程

    這篇文章主要介紹了在Vue項目中引入騰訊驗證碼服務的教程,需要的朋友可以參考下
    2018-04-04
  • 深入解析Vue 組件命名那些事

    深入解析Vue 組件命名那些事

    本篇文章主要介紹了深入解析Vue 組件命名那些事,小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-07-07
  • Vue實現列表跑馬燈效果

    Vue實現列表跑馬燈效果

    這篇文章主要為大家詳細介紹了Vue實現列表跑馬燈效果,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-04-04
  • vue 使用v-for進行循環(huán)的實例代碼詳解

    vue 使用v-for進行循環(huán)的實例代碼詳解

    這篇文章主要介紹了vue 使用v-for進行循環(huán)的實例代碼詳解,本文通過實例代碼給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下
    2020-02-02
  • axios對請求各種異常情況處理的封裝方法

    axios對請求各種異常情況處理的封裝方法

    今天小編就為大家分享一篇axios對請求各種異常情況處理的封裝方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-09-09
  • vue實現動態(tài)表單動態(tài)渲染組件的方式(2)

    vue實現動態(tài)表單動態(tài)渲染組件的方式(2)

    這篇文章主要為大家詳細介紹了vue實現動態(tài)表單動態(tài)渲染組件的方式第二篇,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-04-04
  • iview中實現this.$Modal.confirm自定義彈出框換行加樣式

    iview中實現this.$Modal.confirm自定義彈出框換行加樣式

    這篇文章主要介紹了iview中實現this.$Modal.confirm自定義彈出框換行加樣式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-09-09
  • Vue+jquery實現表格指定列的文字收縮的示例代碼

    Vue+jquery實現表格指定列的文字收縮的示例代碼

    這篇文章主要介紹了Vue+jquery實現表格指定列的文字收縮的示例代碼,小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-01-01
  • vue3中template使用ref無需.value原因解析

    vue3中template使用ref無需.value原因解析

    vue3的template中使用ref變量無需使用.value,還可以在事件處理器中進行賦值操作時,無需使用.value就可以直接修改ref變量的值,這篇文章主要介紹了原來vue3中template使用ref無需.value是因為這個,需要的朋友可以參考下
    2024-06-06
  • vue代理和跨域問題的解決

    vue代理和跨域問題的解決

    這篇文章主要介紹了vue代理和跨域問題的解決,小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-07-07

最新評論