2016-01-24 15:39:34 +08:00
|
|
|
# 固定表头
|
|
|
|
|
|
|
|
- order: 16
|
|
|
|
|
|
|
|
方便一页内展示大量数据。
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
import { Table } from 'antd';
|
|
|
|
|
|
|
|
const columns = [{
|
|
|
|
title: '姓名',
|
|
|
|
dataIndex: 'name',
|
|
|
|
width: 150,
|
|
|
|
}, {
|
|
|
|
title: '年龄',
|
|
|
|
dataIndex: 'age',
|
|
|
|
width: 150,
|
|
|
|
}, {
|
|
|
|
title: '住址',
|
|
|
|
dataIndex: 'address',
|
|
|
|
}];
|
|
|
|
|
|
|
|
const data = [];
|
|
|
|
for (let i = 0; i < 100; i++) {
|
|
|
|
data.push({
|
|
|
|
key: i,
|
2016-02-17 18:04:42 +08:00
|
|
|
name: `李大嘴${i}`,
|
2016-01-24 15:39:34 +08:00
|
|
|
age: 32,
|
2016-02-17 18:04:42 +08:00
|
|
|
address: `西湖区湖底公园${i}号`
|
2016-01-24 15:39:34 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<Table columns={columns} dataSource={data} pagination={{ pageSize: 50 }} useFixedHeader />
|
|
|
|
, mountNode);
|
|
|
|
````
|