diff --git a/src/router/index.js b/src/router/index.js index dec20b21..0a7f623b 100755 --- a/src/router/index.js +++ b/src/router/index.js @@ -116,8 +116,8 @@ const routes = [ let router = new VueRouter({ routes }) router.beforeEach((to, from, next) => { - // 需要身份校验 - if (to.meta.requiresAuth) { + // 验证当前路由所有的匹配中是否需要有登陆验证的 + if (to.matched.some(r => r.meta.requiresAuth)) { // 这里暂时将cookie里是否存有token作为验证是否登陆的条件 // 请根据自身业务需要修改 if (Cookies.get('token')) {