2015-07-09 20:29:26 +08:00
|
|
|
# 分页
|
|
|
|
|
2015-07-14 15:35:17 +08:00
|
|
|
- order: 2
|
2015-07-09 20:29:26 +08:00
|
|
|
|
|
|
|
数据项较多时显示分页。
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
````jsx
|
2015-07-14 15:35:17 +08:00
|
|
|
var Table = antd.Table;
|
|
|
|
|
|
|
|
var columns = [{
|
|
|
|
title: '姓名',
|
2015-07-15 10:47:47 +08:00
|
|
|
dataIndex: 'name',
|
|
|
|
render: function(text) {
|
2015-07-16 18:26:17 +08:00
|
|
|
return <a href="javascript:;">{text}</a>;
|
2015-07-15 10:47:47 +08:00
|
|
|
}
|
2015-07-14 15:35:17 +08:00
|
|
|
}, {
|
|
|
|
title: '年龄',
|
|
|
|
dataIndex: 'age'
|
|
|
|
}, {
|
|
|
|
title: '住址',
|
2015-07-15 10:47:47 +08:00
|
|
|
dataIndex: 'address'
|
2015-07-14 15:35:17 +08:00
|
|
|
}];
|
|
|
|
var data = [];
|
|
|
|
|
2015-07-14 17:58:00 +08:00
|
|
|
for (let i=0; i<18; i++) {
|
2015-07-14 15:35:17 +08:00
|
|
|
data.push({
|
|
|
|
name: '李大嘴' + i,
|
|
|
|
age: 32,
|
2015-07-14 16:34:26 +08:00
|
|
|
address: '西湖区湖底公园' + i + '号'
|
2015-07-14 15:35:17 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
var pagination = {
|
2015-07-28 12:26:54 +08:00
|
|
|
total: data.length,
|
|
|
|
current: 2
|
2015-07-14 15:35:17 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
React.render(<Table columns={columns} dataSource={data} pagination={pagination} />
|
|
|
|
, document.getElementById('components-table-demo-paging'));
|
2015-07-09 20:29:26 +08:00
|
|
|
````
|