-
Notifications
You must be signed in to change notification settings - Fork 1
/
router.js
32 lines (26 loc) · 907 Bytes
/
router.js
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
import Vue from 'vue'
import Router from 'vue-router'
import {scrollBehavior} from '~/utils'
Vue.use(Router)
const page = path => () => import(`~/pages/${path}`).then(m => m.default || m)
const routes = [
{path: '/', name: 'welcome', component: page('index.vue')},
{path: '/checkout', name: 'checkout', component: page('checkout.vue')},
{path: '/login', name: 'login', component: page('auth/login.vue')},
{path: '/register', name: 'register', component: page('auth/register.vue')},
{
path: '/settings',
component: page('settings/index.vue'),
children: [
{path: '', redirect: {name: 'settings.orders'}},
{path: 'orders', name: 'settings.orders', component: page('settings/orders.vue')}
]
}
]
export function createRouter() {
return new Router({
routes,
scrollBehavior,
mode: 'history'
})
}