为什么都没了

This commit is contained in:
路 范
2021-09-24 12:59:34 +08:00
parent a975b3bdee
commit a66921f0f4
962 changed files with 252792 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
const router = new Router({
mode: 'history',
routes: [{
path: '/',
component: () => import('@/views/main/index'),
}, {
path: '/login',
component: () => import('@/views/login/index')
}]
})
// 路由守卫
import { token } from '@/common/token'
router.beforeEach((to, from, next) => {
if (token.value) {
if (to.path === '/login') {
next({
path: '/'
})
} else {
next()
}
} else if (!token.value && to.path !== '/login') {
next({ path: '/login' })
}
next()
})
export default router