// router.js import { RouterMount, createRouter, runtimeQuit } from '@/js_sdk/hhyang-uni-simple-router/uni-simple-router'; import tools from "@/service/tools"; const router = createRouter({ platform: process.env.VUE_APP_PLATFORM, routerErrorEach:({type,level,...args})=>{ // console.log({type,level,...args}) // #ifdef APP-PLUS if(type===3){ router.$lockStatus=false; tools.onBackPress() } // #endif }, routes: [...ROUTES] }); //全局路由前置守卫 const whiteList = ['/pages/login/index'] router.beforeEach((to, from, next) => { const userToken = uni.getStorageSync('token') // #ifdef H5 if(whiteList.indexOf(to.path)<0 && !userToken){ // tools.wxLogin() } // #endif next(); }); // 全局路由后置守卫 router.afterEach((to, from) => { // console.log('后置守卫to------', to) }) export { router, RouterMount }