You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.7 KiB
58 lines
1.7 KiB
import { createRouter, createWebHistory } from 'vue-router'; |
|
const vueRouter = createRouter({ |
|
base: import.meta.env.VITE_APP_BASE, |
|
history: createWebHistory(), |
|
routes: [{ |
|
path: '/', |
|
component: () => import( /* webpackChunkName: "page" */ '@/page/index.vue'), |
|
children: [{ |
|
path: '', |
|
component: () => import( /* webpackChunkName: "page" */ '@/page/list/index.vue'), |
|
}, |
|
{ |
|
path: 'category', |
|
component: () => import( /* webpackChunkName: "page" */ '@/page/list/category.vue'), |
|
}, { |
|
path: 'db', |
|
component: () => import( /* webpackChunkName: "page" */ '@/page/list/db.vue'), |
|
}, { |
|
path: 'map', |
|
component: () => import( /* webpackChunkName: "page" */ '@/page/list/map.vue'), |
|
}, { |
|
path: 'document', |
|
component: () => import( /* webpackChunkName: "page" */ '@/page/list/document.vue'), |
|
}, { |
|
path: 'components', |
|
component: () => import( /* webpackChunkName: "page" */ '@/page/list/components.vue'), |
|
|
|
}, { |
|
path: 'record', |
|
component: () => import( /* webpackChunkName: "page" */ '@/page/list/record.vue'), |
|
|
|
}] |
|
}, { |
|
path: '/create', |
|
name: 'create', |
|
component: () => |
|
import( /* webpackChunkName: "page" */ '@/page/create.vue') |
|
}, { |
|
path: '/build/:id', |
|
name: 'build', |
|
component: () => |
|
import( /* webpackChunkName: "page" */ '@/page/build.vue') |
|
}, { |
|
path: '/view/:id', |
|
name: 'view', |
|
component: () => |
|
import( /* webpackChunkName: "page" */ '@/page/view.vue') |
|
}] |
|
}) |
|
|
|
vueRouter.beforeEach((to, from, next) => { |
|
// 获取当前路由的查询参数 |
|
const queryParams = to.query |
|
queryParams.token && (window.$glob.header['Authorization'] = `Bearer ${queryParams.token}`) |
|
next() |
|
}) |
|
|
|
export default vueRouter;
|
|
|