router.beforeEach((to, from, next) => {
		//console.log("to:", (to));
		//console.log("from:", (from));
		//console.log("next:", (next));
		if(to.path == '/login') {
			window.sessionStorage.removeItem('access-user');
			next();
		} else {
			let user = JSON.parse(window.sessionStorage.getItem('access-user'));
			var toUrl = to.path;
			console.log("jump to login. toUrl:", (toUrl));
			if(!user) {
				next({
					path: '/login',
					query: { url: toUrl }
				});
			} else {
				next();
			}
			next();
		}
	});

  

相关文章:

  • 2022-12-23
  • 2021-09-26
  • 2022-03-09
  • 2021-06-19
  • 2022-12-23
  • 2021-05-31
  • 2021-07-02
猜你喜欢
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
相关资源
相似解决方案