const whiteList = ['/login', '/404']
if (whiteList.includes(to.path)) {
next()
} else {
// 不在白名单内 跳回到登录页
next('/login')
}
数组方法:arry.includes
最新推荐文章于 2022-10-25 14:59:09 发布
const whiteList = ['/login', '/404']
if (whiteList.includes(to.path)) {
next()
} else {
// 不在白名单内 跳回到登录页
next('/login')
}