How to register this package in Vue?
First register this package within your vue instance like this:
import VueLazyLoader from '@startselect/vue-lazyloader';
Vue.use(VueLazyLoader);
Update the image tags
All the images that should be lazyloaded should be updated like this:
<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-lazy-src="/original-image.png">
You can change data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
to anything else.
We did this to load a blank image before this image becomes visible in the viewport.
Options
Available options:
Vue.use(VueLazyLoader, {
offset: 150
});