2.4.0-alpha.0.2 • Published 2 years ago

lazylist-react v2.4.0-alpha.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

lazylist-react

NPM JavaScript Style Guide

Please understand before using

This is a lazy loading component based on intersectionObserver.The child elements under this component render one by default, and When the rendered subcomponent appears in the view, it continues to render the next one, and so on. Each child element is wrapped in a layer of warpTag, You can define its type. The version of react must be greater than or equal to 16.8. Because the component form is hooks.

Install

npm install --save lazylist-react
// or
yarn add lazylist-react

Props

attributevaluetypedescribe
classNamestringthe classname of container
tagdefault: divstringthe nodetype of container
renderCountdefault: 1numberNumber of DOMS per rendering
thresholddefault:0numberRendered elements will continue to render at this scale in the viewport
rootdefault:windowHTMLElementView
warpTagdefault:divHTMLElementA label that wraps each child element
renderCallback(containerInfo,containerVdom,index) => voidCallback function with standard rendering quantity
equalityCheckLimitdefault:100numberLimit for equality check of children keys

Usage

import React from 'react'
import LazyList from 'lazylist-react'

const Example = () => {
  const data = [
  {
    title:'列表1',
    img:'http://xxxx',
    component:<Item title='列表1'/>
  },
  {
    title:'列表2',
    img:'http://xxxx',
    component:<Item title='列表2'/>
  },
  {
    title:'列表3',
    img:'http://xxxx',
    component:<Item title='列表3'/>
  },
]
  return(
    <LazyList>
      {
        data.map(info => {
          return(
            <div>
              <h3>{info.title}</h3>
              <img src={info.img}/>
              {info.component}
            </div>
          )
        })
      }
    </LazyList>
  )
}

License

MIT © mayu888

2.4.0-alpha.0.1

2 years ago

2.4.0-alpha.0.2

2 years ago

2.4.0

3 years ago

2.3.9

3 years ago

2.3.8

3 years ago

2.3.6

3 years ago

2.3.7

3 years ago

2.3.2

3 years ago

2.3.4

3 years ago

2.3.3

3 years ago

2.3.5

3 years ago

2.3.1

3 years ago

2.3.0

3 years ago

2.1.11

3 years ago

2.1.10

3 years ago

2.1.9

3 years ago

2.1.8

3 years ago

2.1.2

3 years ago

2.1.1

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.1.7

3 years ago

2.1.0

3 years ago

1.1.9

3 years ago

2.0.0

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago