康来智慧冷链系统 - 前端
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.
 
 
 
 
 

63 lines
1.9 KiB

import { createRouter, createWebHashHistory } from 'vue-router'
import qs from 'qs'
const vueRouter = createRouter({
base: import.meta.env.VITE_APP_BASE,
history: createWebHashHistory(),
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')
}]
})
/** 解析路由hash模式下url参数 */
const hashUrlParamsRegex = /(?:\?|&)([^=&]+)(?:=([^&]*))?/g
export function parseUrlParams() {
const qsOptions = { ignoreQueryPrefix: true, allowDots: true, skipNulls: true }
const params = Object.assign(
qs.parse(String(location.hash).match(hashUrlParamsRegex)?.join(''), qsOptions),
qs.parse(location.search, qsOptions))
return params
}
export default vueRouter;