2016-11-22 10:11:12 +08:00
|
|
|
|
---
|
|
|
|
|
order: 1
|
|
|
|
|
title:
|
|
|
|
|
en-US: JSX style API
|
|
|
|
|
zh-CN: JSX 风格的 API
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
|
|
使用 JSX 风格的 API(2.5.0 以后引入)
|
|
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
|
|
Using JSX style API (introduced in 2.5.0)
|
|
|
|
|
|
|
|
|
|
````jsx
|
|
|
|
|
import { Table, Icon } from 'antd';
|
|
|
|
|
|
|
|
|
|
const { Column, ColumnGroup } = Table;
|
|
|
|
|
|
|
|
|
|
const data = [{
|
|
|
|
|
key: '1',
|
|
|
|
|
firstName: 'John',
|
|
|
|
|
lastName: 'Brown',
|
|
|
|
|
age: 32,
|
|
|
|
|
address: 'New York No. 1 Lake Park',
|
|
|
|
|
}, {
|
|
|
|
|
key: '2',
|
|
|
|
|
firstName: 'Jim',
|
|
|
|
|
lastName: 'Green',
|
|
|
|
|
age: 42,
|
|
|
|
|
address: 'London No. 1 Lake Park',
|
|
|
|
|
}, {
|
|
|
|
|
key: '3',
|
|
|
|
|
firstName: 'Joe',
|
|
|
|
|
lastName: 'Black',
|
|
|
|
|
age: 32,
|
|
|
|
|
address: 'Sidney No. 1 Lake Park',
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
ReactDOM.render(
|
2016-12-04 17:43:24 +08:00
|
|
|
|
<Table dataSource={data} bordered>
|
2016-11-22 10:11:12 +08:00
|
|
|
|
<ColumnGroup title="Name">
|
|
|
|
|
<Column
|
|
|
|
|
title="First Name"
|
|
|
|
|
dataIndex="firstName"
|
|
|
|
|
key="firstName"
|
|
|
|
|
/>
|
|
|
|
|
<Column
|
|
|
|
|
title="Last Name"
|
|
|
|
|
dataIndex="lastName"
|
|
|
|
|
key="lastName"
|
|
|
|
|
/>
|
|
|
|
|
</ColumnGroup>
|
|
|
|
|
<Column
|
|
|
|
|
title="Age"
|
|
|
|
|
dataIndex="age"
|
|
|
|
|
key="age"
|
|
|
|
|
/>
|
|
|
|
|
<Column
|
|
|
|
|
title="Address"
|
|
|
|
|
dataIndex="address"
|
|
|
|
|
key="address"
|
|
|
|
|
/>
|
|
|
|
|
<Column
|
|
|
|
|
title="Action"
|
|
|
|
|
key="action"
|
|
|
|
|
render={(text, record) => (
|
|
|
|
|
<span>
|
|
|
|
|
<a href="#">Action 一 {record.name}</a>
|
|
|
|
|
<span className="ant-divider" />
|
|
|
|
|
<a href="#">Delete</a>
|
|
|
|
|
<span className="ant-divider" />
|
|
|
|
|
<a href="#" className="ant-dropdown-link">
|
2016-12-04 17:47:45 +08:00
|
|
|
|
More actions <Icon type="down" />
|
2016-11-22 10:11:12 +08:00
|
|
|
|
</a>
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
/>
|
|
|
|
|
</Table>
|
|
|
|
|
, mountNode);
|
|
|
|
|
````
|