Use of asynchronous components

 In the dist directory packaged by webpack, if there is no asynchronous component, app.js will load all the js of all pages when the page is loaded for the first time, wasting performance

 Using asynchronous components, the js file of each page will be separated separately, and the js of which page will be loaded when clicking on that page, improving performance

As follows, the home page is 1.js

 List is 2.js

 Of course, it is only suitable for use when app.js is packaged and at least exceeds 1MB

Otherwise, the cost loss caused by the http request is higher than the cost loss caused by the file size, and the loss outweighs the gain

Guess you like

Origin blog.csdn.net/iaz999/article/details/131263097