npm install react-image-to-lazyload -D
or
yarn add react-image-to-lazyload -D
Example(LazyWrapper):
import * as React from 'react';
import { LazyWrapper } from 'react-image-to-lazyload';
<LazyWrapper placeholder={loading}>
<img data-src={src} name="lazy" />
<img data-src={src} name="lazy" />
<img data-src={src} name="lazy" />
<img data-src={src} name="lazy" />
<img data-src={src} name="lazy" />
<img data-src={src} name="lazy" />
</LazyWrapper>;
Example(LazyItem):
import * as React from 'react';
import { LazyItem } from 'react-image-to-lazyload';
<LazyItem placeholder={loading} url={src}></LazyItem>;
LazyItem 组件的图片路径
Type: string
LazyWrapper 组件的图片路径
Type: string
LazyWrapper 组件的 name: lazy
Type: string
默认图片
Type: string
图片报错显示
Type: string
LazyItem 组件图片加载后的回调
Type: () => void
Type: ObserverOptions
IntersectionObserver options. https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#Intersection_observer_options
Type: React.CSSProperties
Type: React.CSSProperties