Nuxt/test/fixtures/module/router.js

32 lines
689 B
JavaScript
Raw Normal View History

2017-05-21 17:18:26 +00:00
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
2017-07-11 09:03:29 +00:00
const indexPage = () => import('~/views/index.vue').then(m => m.default || m)
const aboutPage = () => import('~/views/about.vue').then(m => m.default || m)
2018-02-07 11:58:48 +00:00
const layoutPage = () => import('~/views/layout.vue').then(m => m.default || m)
2017-07-11 09:03:29 +00:00
export function createRouter () {
2017-05-21 17:18:26 +00:00
return new Router({
mode: 'history',
routes: [
2017-06-29 17:00:18 +00:00
{
path: '/',
2017-07-11 09:03:29 +00:00
component: indexPage,
2017-06-29 17:00:18 +00:00
name: 'index'
},
{
path: '/about',
2017-07-11 09:03:29 +00:00
component: aboutPage,
2017-06-29 17:00:18 +00:00
name: 'about'
2018-02-07 11:58:48 +00:00
},
{
path: '/layout',
component: layoutPage,
name: 'layout'
2017-06-29 17:00:18 +00:00
}
2017-05-21 17:18:26 +00:00
]
})
}