-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.js
More file actions
51 lines (46 loc) · 1 KB
/
router.js
File metadata and controls
51 lines (46 loc) · 1 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import Vue from 'vue'
import Router from 'vue-router'
import HomePage from '~/pages/index.vue'
import Content from '~/components/Content.vue'
Vue.use(Router)
export function createRouter(
ssrContext,
createDefaultRouter,
routerOptions,
config
) {
const options =
routerOptions || createDefaultRouter(ssrContext, config).options
return new Router({
...options,
routes: [
{
path: '/',
component: HomePage,
children: [
{
path: 'about',
component: Content,
},
{
path: 'works',
component: Content,
},
{
path: 'contact',
component: Content,
},
{
path: '',
component: Content,
},
],
},
...fixRoutes(options.routes),
],
})
}
function fixRoutes(defaultRoutes) {
// default routes that come from `pages/`
return defaultRoutes.filter((route) => !(route.path === '/'))
}