router.js 793 B

1234567891011121314151617181920212223242526272829303132
  1. // router.js
  2. import { RouterMount, createRouter, runtimeQuit } from '@/js_sdk/hhyang-uni-simple-router/uni-simple-router';
  3. import tools from "@/service/tools";
  4. import {userWxAppletLogin} from '@/api/user.js'
  5. const router = createRouter({
  6. platform: process.env.VUE_APP_PLATFORM,
  7. routerErrorEach:({type,level,...args})=>{
  8. // console.log({type,level,...args})
  9. // #ifdef APP-PLUS
  10. if(type===3){
  11. router.$lockStatus=false;
  12. tools.onBackPress()
  13. }
  14. // #endif
  15. },
  16. routes: [...ROUTES]
  17. });
  18. //全局路由前置守卫
  19. router.beforeEach( async (to, from, next) => {
  20. next()
  21. });
  22. // 全局路由后置守卫
  23. router.afterEach((to, from) => {
  24. // console.log('后置守卫to------', to)
  25. })
  26. export {
  27. router,
  28. RouterMount
  29. }