There is a site with a lot of photos and text.
The user may not even see through to the end; accordingly, there is no sense in loading the data.
How to make that first all the most necessary would be loaded, and part of the data, then.
Background data vkontse-load at all when scrolling.
In general, the question is more about uploading a webpack.
For example, on YouTube, I see at first a table layout, and then a photo from the video, which speeds up the download.
|
2 answers
asynchronous methods can be used, recently often used along with ES6 .
|
It is convenient to load data in the hook position . Those. the page has opened, the hook has volunteered, and already in the hook is loading.
For background content, callback $ nextTick can be used. This callback is called after the page has been rendered. Called, respectively, after the hook mounted .
For scrolling, you can implement a separate method, and this method is called in the windows.onscroll event. To bind the method and the onscroll event, the event can be added, for example, in the hook hook.
Good luck.
|