virtualList for antd-table, 实现antd-table的虚拟列表, antd-table无限滚动, infinite scrolling for antd-table
npm install virtuallist-antd-keepbash
npm install --save virtuallist-antd
`
Usage
`tsx
import * as React from 'react'
import ReactDom from 'react-dom'
import { VList } from 'virtuallist-antd'
import { Table } from 'antd'
function Example(): JSX.Element {
const dataSource = [...]
const columns = [...]
const rowkey = 'xxx'
return (
dataSource={dataSource}
columns={columns}
rowKey={rowKey}
scroll={{
y: 1000 // 滚动的高度, 可以是受控属性。 (number | string) be controlled.
}}
// 使用VList 即可有虚拟列表的效果
components={VList({
height: 1000 // 此值和scrollY值相同. 必传. (required). same value for scrolly
})}
/>
)
}
ReactDom.render( , dom)
`
VList
`tsx
VList({
height: number | string, // 对应scrollY.
onReachEnd: () => void, // 滚动条滚到底部触发api. (scrollbar to the end)
onScroll: () => void, // 滚动时触发的api. (triggered by scrolling)
})
`
api
`tsx
import { scrollTo } from 'virtuallist-antd'
// scrollTo
scrollTo({
row: number, // 行数. (row number)
y: number, // y偏移量. (offset Y)
})
``