标签:=== outer session col patch login 登录 ati else
在路由文件router下
history.listen(location => { const uid = sessionStorage.getItem(‘uid‘) || localStorage.getItem("uid") console.log(location.pathname) if (location.pathname === ‘/‘ || location.pathname === ‘/login‘) { if (uid) { app._store.dispatch(routerRedux.replace(‘/backstage‘)) } }else{ if(!uid){ app._store.dispatch(routerRedux.push(‘/‘)) } }
添加全局的路由监听。然后判断跳转。
这里只能判断本地的路由登录情况,如果token过期了无法判断
标签:=== outer session col patch login 登录 ati else
原文地址:https://www.cnblogs.com/unreal-feather/p/10332151.html