Skip to content

hjc0930/lazy-pictures

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lazy-pictures

基于IntersectionObserver构造函数编写的React图片懒加载组件

使用

npm i lazy-pictures

示例

import Loader from 'lazy-pictures';
import aPng from './assets/1.jpg';

export default () => {
  return (
    <div style={{ display: 'flex', width: '100%', minWidth: "1200px" }}>
      <h1 style={{ width: '3000px', height: '600px' }}>1</h1>
      <Loader style={{ width: '200px' }} src={aPng} />
    </div>
  );
};