forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrouter.js
More file actions
43 lines (35 loc) · 1.02 KB
/
router.js
File metadata and controls
43 lines (35 loc) · 1.02 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
import Vue from 'vue'
import VueRouter from 'vue-router'
import pages from './pages'
Vue.use(VueRouter)
function load (component) {
return () => System.import(`./components/${component}.vue`)
}
function component (path) {
return {
path: '/' + path.slice(0, path.length - 4),
component: () => System.import(`./components/${path}`)
}
}
let routes = [
{path: '/', component: load('index')},
{
path: '/test-layout',
component: load('test-layout/layout'),
children: [
{path: 'about', component: load('test-layout/about')},
{path: 'layout', redirect: '/test-layout/about'},
{path: 'toolbar', component: load('test-layout/toolbar')},
{path: 'tabs', component: load('test-layout/tabs')},
{path: 'drawer', component: load('test-layout/drawer')}
]
}
]
pages.filter(page => page.indexOf('test-layout') === -1).forEach(page => {
routes.push(component(page))
})
routes.push({path: '*', component: load('error404')})
export default new VueRouter({
// mode: 'history',
routes
})