diff --git a/src/main.js b/src/main.js index 48bac77..d989882 100644 --- a/src/main.js +++ b/src/main.js @@ -13,7 +13,7 @@ Vue.prototype.$axios = axios; //使用钩子函数对路由进行权限跳转 router.beforeEach((to, from, next) => { const role = localStorage.getItem('ms_username'); - if(!role){ + if(!role && to.path !== '/login'){ next('/login'); }else if(to.meta.permission){ // 如果是管理员权限则可进入,这里只是简单的模拟管理员权限而已