vue-lazyload-imgs
Version:
This Vue component vue-lazyload-imgs is used to implement lazy loading of images in Vue2 (Vue>=2.6.0) and Vue3 framework environments. The difference from some lazy loading image instructions is that this component can lazily load any number of images at
29 lines (21 loc) • 578 B
TypeScript
export interface ILazyOptions {
loadingImg?: string;
errorImg?: string;
lifeFunc?: TLifeFunc;
delay?: number;
}
export enum ELifecycle {
LOADING = 'loading',
LOADED = 'loaded',
ERROR = 'error',
}
export type TLifeFunc = {
[K in ELifecycle]?: (imgEl: HTMLImageElement, ...args: any[]) => any;
};
export enum EImgCustAttr {
IMG_ID = 'data-img-id',
ORIG_SRC = 'data-orig-src',
TIMEOUT_ID = 'data-timeout-id',
LOAD_STATUS = 'data-load-status',
}
export type EmitFunc = (event: 'update:modelValue', ...args: any[]) => void;