Vue route interception

Vue.js + webpack projects built without vuex

how to jump directly to the user login interface when there is no login?

disable access to other interfaces without logging in

vue-router how to control

Mar.04,2021

  1. storing an isLogin=true, in the local cookie when logging in
  2. is not logged in as false;
  3. in the routing page router.js, write beforeEach ((to, from, next), to determine which page to go next according to to.name, and whether the isLogin is a page that does not meet the requirements of true;. All the pages that do not meet the requirements are redirected to the login page.

for example:

  https://www.cnblogs.com/guoxi.
					
Menu