vue 路由守卫

router.beforeEach((to, from, next) => {

  // store.commit('numberCardModuleConInit', {
  //   url: to.path
  // });
  store.state.fromPage = from;
  store.commit("setHeaderConfig", to.path);
  // setTimeout(function () {

  if (to.path == '/guidePage' && localStorage.hideGuidePage == "hide") { // 看过引导页 去主页
    store.commit('tohome', {
      router: router
    });
  } else {
    next()
  }
  // }, 0)

})
// router.beforeResolve((to, from, next) => {
//   // console.log('2')
//   // alert('beforeResolve')
//   next()
// })
router.afterEach((to, from) => {
  // console.log('3')
  // alert('afterEach')
  // window._utils_.ajaxLoaderEnd(); //loading

})

  

https://www.tongbiao.xyz/
原文地址:https://www.cnblogs.com/tongbiao/p/9843738.html