feat: 测试代码注释

This commit is contained in:
JiangQiming 2023-01-04 09:55:03 +08:00
parent 5fd1538d94
commit cf9787fd50
2 changed files with 28 additions and 26 deletions

View File

@ -1,7 +1,7 @@
import { createRouter, createWebHashHistory } from 'vue-router';
import menus, { LoginPath } from './menu'
import {LocalStore} from "@/utils/comm";
import {TOKEN_KEY} from "@/utils/variable";
import { LocalStore } from "@/utils/comm";
import { TOKEN_KEY } from "@/utils/variable";
const router = createRouter({
history: createWebHashHistory(),
@ -10,14 +10,14 @@ const router = createRouter({
router.beforeEach((to, from, next) => {
const token = LocalStore.get(TOKEN_KEY)
next()
next() // 测试用, 可删除
if (token) {
next()
} else {
if(to.path === LoginPath) {
if (to.path === LoginPath) {
next()
} else {
next({ path: LoginPath})
next({ path: LoginPath })
}
}
})

View File

@ -1,26 +1,28 @@
export const LoginPath = '/login'
export default [
// {
// path: '/',
// redirect: LoginPath
// },
// {
// path: '/init',
// component: () => import('@/view/InitPage.vue')
// },
// {
// path: LoginPath,
// name: 'login',
// component: () => import('@/view/Login/index.vue')
// },
// {
// path: '/initsetting',
// component: () => import('@/view/Login/initSet.vue')
// }
// {
// path: '/',
// redirect: LoginPath
// },
// {
// path: '/init',
// component: () => import('@/view/InitPage.vue')
// },
// {
// path: LoginPath,
// name: 'login',
// component: () => import('@/view/Login/index.vue')
// },
// {
// path: '/initsetting',
// component: () => import('@/view/Login/initSet.vue')
// }
{
path: '/demo',
component: () => import('@/views/demo/index.vue')
}
// start: 测试用, 可删除
{
path: '/demo',
component: () => import('@/views/demo/index.vue')
}
// end: 测试用, 可删除
]