Created
July 8, 2019 18:16
-
-
Save gufranmirza/80b4fb02119ac26c1e9425bbc8ace41f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue' | |
import Router from 'vue-router' | |
Vue.use(Router) | |
function lazyLoad(view){ | |
return() => import(`@/views/${view}.vue`) | |
} | |
export default new Router({ | |
mode: 'history', | |
base: process.env.BASE_URL, | |
routes: [ | |
{ | |
path: '/', | |
name: 'home', | |
component: lazyLoad('Home') | |
}, | |
{ | |
path: '/about', | |
name: 'about', | |
component: lazyLoad('About') | |
}, | |
{ | |
path: '/extra', | |
name: 'extra', | |
component: lazyLoad('extra') | |
} | |
] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment