diff --git a/src/router/function.js b/src/router/function.js index fa4ad69e4ee55bcbeb38345129f5415ddcfcbbee..4ddc2f431130fc2a05dc205a626d90b7a4bee706 100644 --- a/src/router/function.js +++ b/src/router/function.js @@ -284,19 +284,32 @@ var menuToRouter = (menu) => { e.component = () => import("../page/parent/parent.vue"); menuToRouter(e.children); } else if (e.children && e.menuType !== 0) { - console.log(`@/page/main${e.path}/index.vue`); //叶子层级需要加载到对应文件 //对首页做兼容 - e.component = getViews(e.path); + if(e.source){ + console.log(`@/page/main${e.source}/index.vue`); + e.component = getViews(e.source); + }else{ + console.log(`@/page/main${e.path}/index.vue`); + e.component = getViews(e.path); + } menuToRouter(e.children); } else { console.log(`@/page/main${e.path}/index.vue`); //叶子层级需要加载到对应文件 //对首页做兼容 if (e.path == "/") { - e.component = () => import("../page/main/index/index.vue"); + if(e.source){ + e.component = () => import(`../page/main/${e.source}/index.vue`); + }else{ + e.component = () => import("../page/main/index/index.vue"); + } } else { - e.component = getViews(e.path); + if(e.source){ + e.component = getViews(e.source); + }else{ + e.component = getViews(e.path); + } } } });