From d983f8bc56ecbc506e7b50f68ced0160a904c722 Mon Sep 17 00:00:00 2001 From: zhangjun1 Date: Tue, 22 Nov 2022 14:08:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E8=B5=84=E6=BA=90=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/function.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/router/function.js b/src/router/function.js index fa4ad69..4ddc2f4 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); + } } } }); -- 2.26.0