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
64 lines (56 loc) · 1.4 KB
/
router.js
File metadata and controls
64 lines (56 loc) · 1.4 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
52
53
54
55
56
57
58
59
60
61
62
63
64
import Vue from 'vue'
import VueRouter from 'vue-router'
import pages from './pages'
Vue.use(VueRouter)
function load (component) {
return () => import(`./components/${component}.vue`)
}
function component (path) {
return {
path: '/' + path.slice(0, path.length - 4),
component: () => import(`./components/${path}`)
}
}
let routes = [
{path: '/', component: load('index')},
{
path: '/tabs',
component: load('components/tabs-playground'),
children: [
{ path: 'a' },
{ path: 'a/a' },
{ path: 'a/b' },
{ path: 'b' },
{ path: 'b/a' },
{ path: 'c' }
]
},
{
path: '/lay',
component: load('web-tests/layout'),
children: [
{path: 'a', component: load('web-tests/a')},
{path: 'b', component: load('web-tests/b')},
{path: 'c', component: load('web-tests/c')}
]
},
{
path: '/layout-quick',
component: load('new-layout/new-layout'),
children: [
{path: '', redirect: 'default'},
{path: 'default', component: load('new-layout/pages/default')},
{path: 'a', component: load('new-layout/pages/a')},
{path: 'b', component: load('new-layout/pages/b')},
{path: 'c', component: load('new-layout/pages/c')}
]
}
]
pages.forEach(page => {
routes.push(component(page))
})
routes.push({path: '*', component: load('error404')})
export default new VueRouter({
// mode: 'history',
routes
})