feat: 测试代码注释
This commit is contained in:
parent
5fd1538d94
commit
cf9787fd50
|
@ -1,7 +1,7 @@
|
||||||
import { createRouter, createWebHashHistory } from 'vue-router';
|
import { createRouter, createWebHashHistory } from 'vue-router';
|
||||||
import menus, { LoginPath } from './menu'
|
import menus, { LoginPath } from './menu'
|
||||||
import {LocalStore} from "@/utils/comm";
|
import { LocalStore } from "@/utils/comm";
|
||||||
import {TOKEN_KEY} from "@/utils/variable";
|
import { TOKEN_KEY } from "@/utils/variable";
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHashHistory(),
|
history: createWebHashHistory(),
|
||||||
|
@ -10,14 +10,14 @@ const router = createRouter({
|
||||||
|
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
const token = LocalStore.get(TOKEN_KEY)
|
const token = LocalStore.get(TOKEN_KEY)
|
||||||
next()
|
next() // 测试用, 可删除
|
||||||
if (token) {
|
if (token) {
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
if(to.path === LoginPath) {
|
if (to.path === LoginPath) {
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
next({ path: LoginPath})
|
next({ path: LoginPath })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -19,8 +19,10 @@ export default [
|
||||||
// component: () => import('@/view/Login/initSet.vue')
|
// component: () => import('@/view/Login/initSet.vue')
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// start: 测试用, 可删除
|
||||||
{
|
{
|
||||||
path: '/demo',
|
path: '/demo',
|
||||||
component: () => import('@/views/demo/index.vue')
|
component: () => import('@/views/demo/index.vue')
|
||||||
}
|
}
|
||||||
|
// end: 测试用, 可删除
|
||||||
]
|
]
|
Loading…
Reference in New Issue