zhaohy
3 months ago
1 changed files with 0 additions and 44 deletions
@ -1,44 +0,0 @@ |
|||||
const sessionStoreRoute = sessionStorage.getItem("dynamicRouteList"); |
|
||||
let getDynamicRouteList = sessionStoreRoute?JSON.parse(sessionStoreRoute):[]; |
|
||||
let dynamicRoute:any = []; |
|
||||
// getDynamicRouteList.map(itemRouter => {
|
|
||||
// if(itemRouter.children && itemRouter.children.length > 0){
|
|
||||
// itemRouter.children.map(childRoute => {
|
|
||||
// let modulePath0 = childRoute.component;
|
|
||||
// childRoute.component = () => new Function(`return import('/nerv-lib/saas/view/${modulePath0}')`)();///nerv-lib/saas/view/
|
|
||||
// if(childRoute.children && childRoute.children.length > 0){
|
|
||||
// childRoute.children.map(child2=>{
|
|
||||
// let modulePath = child2.component;
|
|
||||
// child2.component = () => new Function(`return import('/@/view/${modulePath}')`)();///@/view/
|
|
||||
// })
|
|
||||
// }else{//如没有下一级菜单代表是一级,重新处理一级菜单路由
|
|
||||
// childRoute.component = () => new Function(`return import('/@/view/${modulePath0}')`)();
|
|
||||
// }
|
|
||||
// })
|
|
||||
// }
|
|
||||
// dynamicRoute.push(itemRouter)
|
|
||||
// })
|
|
||||
getDynamicRouteList.forEach(itemRouter => { |
|
||||
if (itemRouter.children && itemRouter.children.length > 0) { |
|
||||
itemRouter.children.forEach(childRoute => { |
|
||||
const modulePath0 = childRoute.component; |
|
||||
// 修改 component 属性
|
|
||||
// childRoute.component = () => import(`/nerv-lib/saas/view/${modulePath0}`).then(mod => mod.default);
|
|
||||
childRoute.component = () => new Function(`return import('/nerv-lib/saas/view/${modulePath0}')`)(); |
|
||||
|
|
||||
if (childRoute.children && childRoute.children.length > 0) { |
|
||||
childRoute.children.forEach(child2 => { |
|
||||
const modulePath = child2.component; |
|
||||
// 修改 component 属性
|
|
||||
// child2.component = /* @vite-ignore */ () => import(`/@/view/${modulePath}`).then(mod => mod.default);
|
|
||||
child2.component = () => new Function(`return import('/@/view/${modulePath}')`)(); |
|
||||
}); |
|
||||
} else { // 如果没有下一级菜单代表是一级,重新处理一级菜单路由
|
|
||||
// childRoute.component = /* @vite-ignore */ () => import(`/@/view/${modulePath0}`).then(mod => mod.default);
|
|
||||
childRoute.component = () => new Function(`return import('/@/view/${modulePath0}')`)(); |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
dynamicRoute.push(itemRouter); |
|
||||
}); |
|
||||
export default dynamicRoute; |
|
Loading…
Reference in new issue