vue权限认证

102 阅读1分钟
	router.beforeEach((to, from, next) => {
  if (to.name == "person") {
    if (localStorage.getItem("Token")) {
      next();
    } else {
      next({
        path: "/login",
        query: { redirect: to.fullPath }
      })
    }
  } else {
    next();
  }
});