[配置]配置router

This commit is contained in:
唐明明
2021-07-23 11:52:32 +08:00
parent 17679fa432
commit 564ed944d4
57 changed files with 10291 additions and 92 deletions

View File

@@ -6,7 +6,7 @@
*/
import { RouterMount, createRouter } from 'uni-simple-router';
import store from '../store/index'
// import store from '../store/index'
const router = createRouter({
platform: process.env.VUE_APP_PLATFORM,
@@ -15,21 +15,23 @@ const router = createRouter({
// 全局路由前置守卫
router.beforeEach((to, from, next) => {
const token = store.getters.getToken || uni.getStorageSync('token')
if(to.meta.auth && token === ''){
next({
name: 'Login',
NAVTYPE: 'replaceAll'
})
return
}
if(to.name === 'Welcome'){
next({
name: 'ChainIndex',
NAVTYPE: 'replaceAll'
})
return
}
console.log(to)
console.log(from)
// const token = store.getters.getToken || uni.getStorageSync('token')
// if(to.meta.auth && token === ''){
// next({
// name: 'Login',
// NAVTYPE: 'replaceAll'
// })
// return
// }
// if(to.name === 'Welcome'){
// next({
// name: 'ChainIndex',
// NAVTYPE: 'replaceAll'
// })
// return
// }
next();
})