根据当前环境设置路由跳转方式
This commit is contained in:
parent
378ae54916
commit
f6c2d8fb6e
12
router.js
12
router.js
@ -74,13 +74,23 @@ router.beforeEach((to, from, next) => {
|
||||
// #endif
|
||||
|
||||
|
||||
console.log(to,from, 'beforeEach---开始跳转')
|
||||
let index = whiteList.findIndex((item) => from.path.includes(item))
|
||||
if (index == -1 && !store.getters.token) {
|
||||
Cache.set(BACK_URL, from.fullPath)
|
||||
}
|
||||
if (to.meta.auth && !store.getters.token) {
|
||||
// #ifdef APP-PLUS
|
||||
next(false)
|
||||
uni.navigateTo({
|
||||
url: '/pages/login/login'
|
||||
})
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
next('/pages/login/login');
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
next('/pages/login/login');
|
||||
// #endif
|
||||
return
|
||||
} else {
|
||||
next()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user