This commit is contained in:
唐明明
2021-09-23 17:03:28 +08:00
parent d4bd0ac010
commit 08c56ea921
245 changed files with 40734 additions and 80 deletions

34
router/index.js Normal file
View File

@@ -0,0 +1,34 @@
/**
* Web唐明明
* 匆匆数载恍如梦,岁月迢迢华发增。
* 碌碌无为枉半生,一朝惊醒万事空。
* moduleName: router
*/
import { RouterMount, createRouter } from 'uni-simple-router';
import store from '../store/index'
const router = createRouter({
platform: process.env.VUE_APP_PLATFORM,
routes: [...ROUTES]
})
// 全局路由前置守卫
router.beforeEach((to, from, next) => {
const token = store.getters.getToken || uni.getStorageSync('token')
// 检查是否需要登录
if(to.meta.auth && token === ''){
return
}
next();
})
// 全局路由后置守卫
router.afterEach((to, from) => {
// console.log('跳转结束--暂无应用场景')
})
export {
router,
RouterMount
}