Commit 666b6a5e authored by 李苏's avatar 李苏 💬

router

parent 14cb589a
import auth from '@/plugins/auth' import auth from '@/plugins/auth'
import router, { constantRoutes, dynamicRoutes } from '@/router' import router, { constantRoutes, dynamicRoutes,powerRoutes } from '@/router'
import { getRouters } from '@/api/menu' import { getRouters } from '@/api/menu'
import Layout from '@/layout/index' import Layout from '@/layout/index'
import ParentView from '@/components/ParentView' import ParentView from '@/components/ParentView'
...@@ -79,7 +79,31 @@ const permission = { ...@@ -79,7 +79,31 @@ const permission = {
getRouters({}).then(res => { getRouters({}).then(res => {
let menus=res.data.menu let menus=res.data.menu
console.log(res.data.mk,res.data.menu,'look') /* 权限路由*/
console.log(menus,'权限路由——————————————————————————————',powerRoutes)
/* */
let mapTree=function(arr){
/* 逻辑判断*/
arr.forEach((item,index)=>{
let mkid=item.meta.mkid
let hasMkid=false
menus.forEach(e=>{
if(e.mkid==mkid){
hasMkid=true
}
})
/* 存在权限*/
if(hasMkid){
}else{
arr.splice(index,1)
}
if(item.children&&item.children.length>0){
mapTree(item.children)
}
})
return arr
}
/* 转化菜单格式*/ /* 转化菜单格式*/
let delArr=[] let delArr=[]
menus.forEach((item,index)=>{ menus.forEach((item,index)=>{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment