2020-12-25 18:15:04 +08:00
|
|
|
import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router"
|
|
|
|
|
|
|
|
const staticRoutes: Array<RouteRecordRaw> = [
|
|
|
|
{
|
|
|
|
path: '/',
|
|
|
|
name: 'home',
|
|
|
|
component: () => import('/@/views/layout/index.vue'),
|
|
|
|
redirect: '/home',
|
|
|
|
meta: {
|
2020-12-31 11:47:52 +08:00
|
|
|
title: '首页',
|
|
|
|
index: 0
|
2020-12-25 18:15:04 +08:00
|
|
|
},
|
|
|
|
children: [{
|
|
|
|
path: '/home',
|
|
|
|
name: 'home',
|
|
|
|
component: () => import('/@/views/home/index.vue'),
|
|
|
|
meta: {
|
2020-12-31 11:47:52 +08:00
|
|
|
title: '首页',
|
|
|
|
index: 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/docs',
|
|
|
|
name: 'docs',
|
|
|
|
component: () => import('/@/views/docs/index.vue'),
|
|
|
|
meta: {
|
|
|
|
title: '文档',
|
|
|
|
index: 1
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/docs1',
|
|
|
|
name: 'docs1',
|
|
|
|
component: () => import('/@/views/docs copy 1/index.vue'),
|
|
|
|
meta: {
|
|
|
|
title: '文档1',
|
|
|
|
index: 2
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/docs2',
|
|
|
|
name: 'docs2',
|
|
|
|
component: () => import('/@/views/docs copy 2/index.vue'),
|
|
|
|
meta: {
|
|
|
|
title: '文档2',
|
|
|
|
index: 3
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/docs3',
|
|
|
|
name: 'docs3',
|
|
|
|
component: () => import('/@/views/docs copy 3/index.vue'),
|
|
|
|
meta: {
|
|
|
|
title: '文档3',
|
|
|
|
index: 4
|
|
|
|
}
|
2020-12-25 18:15:04 +08:00
|
|
|
}]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/login',
|
|
|
|
name: 'login',
|
|
|
|
component: () => import('/@/views/login/index.vue'),
|
|
|
|
meta: {
|
|
|
|
title: '登陆'
|
|
|
|
}
|
|
|
|
},
|
2020-12-31 11:47:52 +08:00
|
|
|
{
|
|
|
|
path: '/404',
|
|
|
|
name: '404',
|
|
|
|
component: () => import('/@/views/error/404.vue'),
|
|
|
|
meta: {
|
|
|
|
title: '找不到此页面'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: '/401',
|
|
|
|
name: '401',
|
|
|
|
component: () => import('/@/views/error/401.vue'),
|
|
|
|
meta: {
|
|
|
|
title: '没有权限'
|
|
|
|
}
|
|
|
|
},
|
2020-12-25 18:15:04 +08:00
|
|
|
{
|
|
|
|
path: '/:pathMatch(.*)',
|
2020-12-31 11:47:52 +08:00
|
|
|
redirect: '/404'
|
2020-12-25 18:15:04 +08:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
const router = createRouter({
|
|
|
|
history: createWebHashHistory(),
|
|
|
|
routes: staticRoutes
|
|
|
|
})
|
|
|
|
|
2020-12-31 11:47:52 +08:00
|
|
|
// router.afterEach((to, from) => {
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
2020-12-25 18:15:04 +08:00
|
|
|
export default router
|