菜单动态路由及头部角色切换修改
This commit is contained in:
25
lib/util/dynamicRoutesss.ts
Normal file
25
lib/util/dynamicRoutesss.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
//处理路由compontent路径
|
||||
export const replyDynamRoutesPath = (data:any) => {
|
||||
return data.map(item => {
|
||||
if(item.children && item.children.length > 0){
|
||||
item.children.map(itemChild => {
|
||||
if(itemChild.component){
|
||||
const modulePath0 = itemChild.component;
|
||||
itemChild.component = () => new Function(`return import('/nerv-lib/saas/view/${modulePath0}')`)();
|
||||
if(itemChild.children && itemChild.children.length > 0){
|
||||
itemChild.children.map(itemChildChild => {
|
||||
if(itemChildChild.component){
|
||||
const modulePath1 = itemChildChild.component;
|
||||
itemChildChild.component = () => new Function(`return import('/@/view/${modulePath1}')`)();
|
||||
}
|
||||
})
|
||||
}else{
|
||||
itemChild.component = () => new Function(`return import('/@/view/${modulePath0}')`)();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
return item;
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user