@unlazy/vue
Version:
Vue lazy loading library for placeholder images
39 lines (38 loc) • 2.08 kB
TypeScript
import * as _$vue from "vue";
import { ImgHTMLAttributes } from "vue";
import { UnLazySource } from "unlazy";
//#region src/components/UnLazyImage.vue.d.ts
type __VLS_Props = {
/** Image source URL to be lazy-loaded. */src?: ImgHTMLAttributes['src']; /** Image source set to be lazy-loaded. */
srcSet?: ImgHTMLAttributes['srcset']; /** Image source URLs for different resolutions. This will render the `<picture>` element instead of `<img>`. */
sources?: UnLazySource[];
/**
* A flag to indicate whether the sizes attribute should be automatically calculated.
* @default false
*/
autoSizes?: boolean; /** A BlurHash string representing the blurry placeholder image. */
blurhash?: string; /** A ThumbHash string representing the blurry placeholder image. */
thumbhash?: string; /** Optional image source URL for a custom placeholder image. Will be ignored if a BlurHash or ThumbHash is provided. */
placeholderSrc?: string; /** The size of the longer edge (width or height) of the BlurHash image to be decoded, depending on the aspect ratio. This option only applies when the `blurhash` prop is used. */
placeholderSize?: number;
/**
* A flag to indicate whether the image should be preloaded, even if it is not in the viewport yet.
* @default false
*/
preload?: boolean;
/**
* Allows to specify the loading strategy of the image.
* @default 'lazy'
*/
loading?: ImgHTMLAttributes['loading'];
};
declare const __VLS_export: _$vue.DefineComponent<__VLS_Props, {}, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {} & {
imageError: (image: HTMLImageElement, error: Event) => any;
imageLoad: (image: HTMLImageElement) => any;
}, string, _$vue.PublicProps, Readonly<__VLS_Props> & Readonly<{
onImageError?: ((image: HTMLImageElement, error: Event) => any) | undefined;
onImageLoad?: ((image: HTMLImageElement) => any) | undefined;
}>, {}, {}, {}, {}, string, _$vue.ComponentProvideOptions, false, {}, any>;
declare const _default: typeof __VLS_export;
//#endregion
export { _default as UnLazyImage };