Created
October 24, 2018 18:02
-
-
Save rafaeldo/eaded07416bfadc29de5d54cae1f3d39 to your computer and use it in GitHub Desktop.
Dynamic Load Component in Vue (Example)
This file contains hidden or 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' | |
import Home from './views/Home.vue' | |
Vue.use(Router) | |
export default new Router({ | |
mode: 'history', | |
base: process.env.BASE_URL, | |
routes: [ | |
{ | |
path: '/', | |
name: 'home', | |
component: Home | |
}, | |
{ | |
path: '/about', | |
name: 'about', | |
component: () => import(/* webpackChunkName: "about" */ './views/About.vue') | |
} | |
] | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment