圖片懶加載的簡單效果已經實現了,而後就能夠按這開發文檔的api進行擴展了:動畫
key | description | default | options |
---|---|---|---|
preLoad |
proportion of pre-loading height(預加載高度比例) | 1.3 |
Number |
error |
src of the image upon load fail(圖片路徑錯誤時加載圖片) | 'data-src' |
String |
loading |
src of the image while loading(預加載圖片) | 'data-src' |
String |
attempt |
attempts count(嘗試加載圖片數量) | 3 |
Number |
listenEvents |
events that you want vue listen forspa (想要監聽的vue事件) 默認['scroll']能夠省略, 當插件跟頁面中的動畫或過渡等事件有衝突是, 能夠嘗試其餘選項 |
|
Desired Listen Events |
adapter |
dynamically modify the attribute of element (動態修改元素屬性) |
{ } |
Element Adapter |
filter |
the image's listener filter(動態修改圖片地址路徑) | { } |
Image listener filter |
lazyComponent |
lazyload component | false |
Lazy Component |
dispatchEvent |
trigger the dom event | false |
Boolean |
throttleWait |
throttle wait | 200 |
Number |
observer |
use IntersectionObserver | false |
Boolean |
observerOptions |
IntersectionObserver options | { rootMargin: '0px', threshold: 0.1 } | IntersectionObserver |