Created
March 19, 2020 14:06
-
-
Save webdesignberlin/726eecd41c69dd9f991dd21668966764 to your computer and use it in GitHub Desktop.
Vue Lazy Loading
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
components: { | |
AsyncComponent: () => import('./AsyncComponent'), | |
/** | |
With named export, use Object Destructuring on the returned Promise. | |
*/ | |
AsyncComponent2: () => import('AsyncComponentLib').then(({ AsyncComponent2 }) => AsyncComponent2), | |
}, |
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
const UserEdit = () => import('./user-edit.vue'); | |
new VueRouter({ | |
routes: [ | |
{ | |
path: "/user-edit", | |
component: UserEdit, | |
}, | |
{ | |
path: "/alternate", | |
component: () => import('./alternate.vue'), | |
} | |
] | |
}); |
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
const store = new Vuex.Store(); | |
import('./store-modules/user').then(userModule => { | |
store.registerModule('user', userModule) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment