//钩子 登录拦截 router.beforeEach((to, from, next) => { const sessionToken = window.sessionStorage.getItem("token"); if(to.path === '/' || to.path === '/Login') { next(); } else {//在这里可以做一些路由判断哦 if(sessionToken !=''&&sessionToken !='null'&&sessionToken !=null) { next(); } else { next('/Login'); } } })