Skip to content

Instantly share code, notes, and snippets.

@webdesignberlin
Created March 19, 2020 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webdesignberlin/726eecd41c69dd9f991dd21668966764 to your computer and use it in GitHub Desktop.
Save webdesignberlin/726eecd41c69dd9f991dd21668966764 to your computer and use it in GitHub Desktop.
Vue Lazy Loading
components: {
AsyncComponent: () => import('./AsyncComponent'),
/**
With named export, use Object Destructuring on the returned Promise.
*/
AsyncComponent2: () => import('AsyncComponentLib').then(({ AsyncComponent2 }) => AsyncComponent2),
},
const UserEdit = () => import('./user-edit.vue');
new VueRouter({
routes: [
{
path: "/user-edit",
component: UserEdit,
},
{
path: "/alternate",
component: () => import('./alternate.vue'),
}
]
});
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