On the problem of repeated request for pictures by vue-lazyload

1. I used vue-lazyload, in the project, but found that some people who asked for pictures would repeat the request, causing the web page to load too slowly

.

2.
clipboard.png

3.
clipboard.png

4.

clipboard.png

Mar.12,2021

in the debugging tool in Google browser, network, uncheck the disable cache


also encounter this problem. Have you solved the problem


add: key is OK: key='item.src'


Hello, ask you, that is to see that you also put forward the problem of repeated loading of images in the v-lazy plug-in, have you solved this problem?


I also encountered the same problem. How is it realized?


Today I happen to encounter this problem. The same image will be requested twice. It is not a problem that google disabled cache or key did not add. The reason is that the address of the requested picture is caused by session_start. If you go to the session_start, you can only load it once. After investigation, it is because header head with Cache-cancel = no Cache, is estimated to be the same as google disabled cache!


Vue.use(VueLazyload, {
  preLoad: 1.3,
  error: 'dist/error.png',
  loading: 'dist/loading.gif',
  attempt: 1  
})

add the attempt attribute


first of all, a duplicate request should have been sent.
but how much is the impact of this repeat request?

  • usually pictures are cached, so when caching is used, requests are not repeated, so the impact of repeated requests is negligible.
  • if disable cache, is enabled, the request will be repeated. But the effect is much better than not using vmurazy v-lazy, so even if the request is repeated, it is still cost-effective. Moreover, users will not take the initiative to disable cache at all.

to sum up, even if you repeat the request, you should firmly use vmurlaz.

Menu