1
0
Fork 0
my_spells/src/router.js
2017-05-25 08:03:54 -05:00

30 lines
956 B
JavaScript

import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
function load (component) {
return () => System.import(`components/${component}.vue`)
}
export default new VueRouter({
/*
* NOTE! VueRouter "history" mode DOESN'T works for Cordova builds,
* it is only to be used only for websites.
*
* If you decide to go with "history" mode, please also open /config/index.js
* and set "build.publicPath" to something other than an empty string.
* Example: '/' instead of current ''
*
* If switching back to default "hash" mode, don't forget to set the
* build publicPath back to '' so Cordova builds work again.
*/
routes: [
{ path: '/', component: load('Index') }, // Default
{ path: '/my', component: load('Myspells') },
{ path: '/spell/:name', component: load('Spell') },
{ path: '/about', component: load('About') },
{ path: '*', component: load('Error404') } // Not found
]
})