
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ant-virtual-table
Advanced tools
English | 简体中文
这是一个ant的虚拟表格,用于解决大数据渲染时页面卡顿的问题,本组件是对ant.desigin中Table组件进行一层封装,属性完全与原组件Table保持一致 AntDesign Table,可以让你像使用普通table一样使用虚拟table。例子中处理渲染1000万条数据,页面也非常流畅。在线demo
考虑到兼容性问题,内部通过监听Table的滚动事件判断滑动行的位置,没有采用H5新特性IntersectionObserver。因此兼容性问题是比较好的。另外组件引入loash的throttle处理抖动问题,目前没有采用raf
npm install ant-virtual-table --save-dev

import React, { Component, Fragment } from 'react'
import { VirtualTable } from 'ant-virtual-table'
import 'antd/dist/antd.css'
const columns = [
{
title: '序号',
dataIndex: 'id',
width: 100
},
{
title: '姓名',
dataIndex: 'name',
width: 150
},
{
title: '年龄',
dataIndex: 'age',
width: 100
},
{
title: '性别',
dataIndex: 'sex',
width: 100,
render: (text) => {
return text === 'male' ? '男' : '女'
}
},
{
title: '地址',
dataIndex: 'address',
key: 'address'
}
]
function generateData () {
const res = []
const names = ['Tom', 'Marry', 'Jack', 'Lorry', 'Tanken', 'Salla']
const sexs = ['male', 'female']
for (let i = 0; i < 10000000; i++) {
let obj = {
id: i,
name: names[i % names.length] + i,
sex: sexs[i % sexs.length],
age: 15 + Math.round(10 * Math.random()),
address: '浙江省杭州市西湖区华星时代广场2号楼'
}
res.push(obj)
}
return res
}
const dataSource = generateData()
class App extends Component {
render () {
return (
<Fragment>
<VirtualTable
columns={columns}
dataSource={dataSource}
rowKey='id'
pagination={{ pageSize: 40 }}
scroll={{ y: 400 }}
bordered
/>
</Fragment>
)
}
}
为降低迁移成本,属性与antd的Table完全保持一致,暂时没有自身独特的属性
目前暂不支持内嵌tree等复杂的表单结构,任何复杂的表单结构都不建议使用,后续跟进当中...
FAQs
[English](./README-en_EN.md) | 简体中文
We found that ant-virtual-table demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.