Vue routes are loaded lazily
Component: resolve=>(require([' Router ']), resolve) import Vue from 'Vue' import Router from 'vue-router'     Use (Router) export default new Router({routes: [{path: '/', name: 'HelloWorld', component: Resolve =>(require(["@/components/HelloWorld"],resolve))}]}) Const HelloWorld = () =>import(' module address to load ') import Vue from 'Vue' import Router from 'vue-router' vue.use (Router) const HelloWorld = ()=>import("@/components/HelloWorld") export default new Router({ routes: [ { path: '/', name: 'HelloWorld', component:HelloWorld } ] })Copy the code
Component lazy loading
1. Asynchronous <template> <div class="hello"> < one-com ></ one-com > 1111 </div> </template> <script> export default { components:{ "One-com":resolve=>(['./one'],resolve) }, data () { return { msg: ES6 const method <template> <div class="hello"> < one-com ></ one-com > 1111 </div> </template> <script> const One = ()=>import("./one"); export default { components:{ "One-com":One }, data () { return { msg: 'Welcome to Your Vue.js App' } } } </script>Copy the code