Commit 3bd65434 by hank

路由优化

parent cc2a9e59
......@@ -98,11 +98,17 @@ const router = new Router({
router.beforeEach((from, to , next) => {
// 路由拦截
// console.log(from, to)
if(window.localStorage.getItem('login') || from.path === '/login') {
if(window.localStorage.getItem('login') ) {
if(to.path === '/login' || from.path === '/login') {
next({ path: '/' })
} else {
next()
}
} else {
// router.redirect()
if(to.path === '/login') {
console.log('redirect')
console.log(to, from.path)
if(from.path === '/login') {
// console.log('11212')
next()
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment