vue路由前卫拦截
报错:RangeError: Maximum call stack size exceeded at VueRouter.match 循环多次
修改(排除页面)
router
.beforeEach((to
, from, next
) => {
let token
= localStorage
.getItem('token');
const outerPaths
= ['/login'];
if (!token
&& !outerPaths
.includes(to
.path
)) {
next({
path
: '/login',
replace
: true
});
} else {
next();
}
});
转载请注明原文地址:https://tech.qufami.com/read-23897.html