From 18cbf254a090edf9ad232e7ac9440724b23401a6 Mon Sep 17 00:00:00 2001 From: zhangjun1 Date: Wed, 23 Nov 2022 15:42:52 +0800 Subject: [PATCH] =?UTF-8?q?route=E5=AE=B9=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 146ac3a..2502506 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -89,9 +89,11 @@ router.beforeEach((to, from, next) => { // }) function addRoute(router,routers){ routers.forEach(e => { - router.addRoute(e) - if(e.children&&e.children.length){ - addRoute(router,e.children) + if(e.path[0]=='/'){ + router.addRoute(e) + if(e.children&&e.children.length){ + addRoute(router,e.children) + } } }); } -- 2.26.0