router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title
  }
/**
 * 添加版本号
**/
  if (document.URL.indexOf('?t=') < 0) {
    let timestamp = (new Date()).valueOf()
    window.location.href = '?t=' + timestamp + '#' + to.fullPath
  }
  if (to.meta.requireAuth) {
    if (getStore('personal') && getStore("loginFlag") == 1) {
      next();
    } else {
      next({
        path: '/login',
        query: {redirect: to.fullPath}
      })
    }
  } else {
    next();
  }
});
Logo

前往低代码交流专区

更多推荐