When using Vue, the page freezes due to sudden loading. How to solve it?

 Solve the problem of slow first loading. Lazy loading is simply loading on demand

1. For a single-page application like vue, if there is no lazy loading, the file packaged by webpack
will be extremely large, resulting in too much content to be loaded when entering the homepage, and the time is too long, resulting in long-term white space
screen, even if loading is done, it is not conducive to user experience.


2. Lazy loading can be used to divide pages and load pages when needed, which can effectively share the
loading pressure on the homepage and reduce the loading time of the homepage.


3. Usage: Use when configuring routing: component:resolve=>require(["@components/routing
path"], resolve). That is, after using lazy loading and running the index.html directly after packaging, an error will be reported. The reported file reference error is actually a problem with the path configuration during packaging. Find webpack.prod.conf.js
under build and add publicPath: "./"
,

Acho que você gosta

Origin blog.csdn.net/CQXXTXX/article/details/128998218
Recomendado
Clasificación