src/router/index.ts
@@ -36,18 +36,22 @@ document.title = to.meta.title } // 看看有没有toke const token = Session.get('token'); const token = Session.get('token') console.log(!token) if (to.path === '/login') { next(); next() }else{ if (!token){ next('/login'); next('/login') }else{ console.log('---') if (to.path === '/'){ await userInfo.setPatientApi() next(); await userInfo.setPatientApi() } next() } } })