-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
33 lines (30 loc) · 844 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import { getBasePath } from '@/basePath'
const createVueRouter = () => {
const paths = getBasePath()
const history = createWebHistory(paths.documentBase)
const router = createRouter({
history,
routes: [
{
path: paths.parcelBase,
name: 'home',
component: HomeView
},
{
path: `${paths.parcelBase}about`,
name: 'about',
// route level code-splitting
// this generates a separate chunk (About.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import('../views/AboutView.vue')
}
]
})
return {
router,
cleanup: () => history.destroy()
}
}
export default createVueRouter