From aaaa9028f0a534bca98a653f7957232e918f1d9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E8=BF=90=E6=A8=A1?= <1724894114@qq.com> Date: Mon, 25 Nov 2024 22:59:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7=E7=AB=AF?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 44e3f3d..e7a973d 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -47,14 +47,17 @@ router.beforeEach(async (to, from, next) => { next(); return false; } - // console.log(routes,to,6999) if(routes.findIndex(r => r.path === to.path) >= 0){ - // if(to.toShow && !token){ - // next({ - // path: '/login' - // }); - // return false; - // } + routes.forEach(item=>{ + if(item.tokenShow && item.path === to.path){ + if(!token){ + next({ + path: '/login' + }); + return false; + } + } + }) next(); return false; }