2016-03-31 09:40:55 +08:00
|
|
|
---
|
2019-11-15 14:35:25 +08:00
|
|
|
order: 12
|
2016-08-15 07:54:01 +08:00
|
|
|
title:
|
|
|
|
en-US: border, title and footer
|
2016-11-14 14:26:08 +08:00
|
|
|
zh-CN: 带边框
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-08-11 20:05:52 +08:00
|
|
|
|
2016-08-15 07:54:01 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2016-07-21 15:14:42 +08:00
|
|
|
添加表格边框线,页头和页脚。
|
2015-08-11 20:05:52 +08:00
|
|
|
|
2016-08-15 08:07:03 +08:00
|
|
|
## en-US
|
|
|
|
|
|
|
|
Add border, title and footer for table.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
|
|
|
import React from 'react';
|
2015-10-28 20:55:49 +08:00
|
|
|
import { Table } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import type { ColumnsType } from 'antd/lib/table';
|
2015-10-28 20:55:49 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
interface DataType {
|
|
|
|
key: string;
|
|
|
|
name: string;
|
|
|
|
money: string;
|
|
|
|
address: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const columns: ColumnsType<DataType> = [
|
2019-05-07 14:57:32 +08:00
|
|
|
{
|
|
|
|
title: 'Name',
|
|
|
|
dataIndex: 'name',
|
2019-08-14 19:36:59 +08:00
|
|
|
render: text => <a>{text}</a>,
|
2019-05-07 14:57:32 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Cash Assets',
|
|
|
|
className: 'column-money',
|
|
|
|
dataIndex: 'money',
|
2020-05-03 19:46:52 +08:00
|
|
|
align: 'right',
|
2019-05-07 14:57:32 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Address',
|
|
|
|
dataIndex: 'address',
|
|
|
|
},
|
|
|
|
];
|
2015-08-11 20:05:52 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const data: DataType[] = [
|
2019-05-07 14:57:32 +08:00
|
|
|
{
|
|
|
|
key: '1',
|
|
|
|
name: 'John Brown',
|
|
|
|
money: '¥300,000.00',
|
|
|
|
address: 'New York No. 1 Lake Park',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '2',
|
|
|
|
name: 'Jim Green',
|
|
|
|
money: '¥1,256,000.00',
|
|
|
|
address: 'London No. 1 Lake Park',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
name: 'Joe Black',
|
|
|
|
money: '¥120,000.00',
|
|
|
|
address: 'Sidney No. 1 Lake Park',
|
|
|
|
},
|
|
|
|
];
|
2015-08-11 20:05:52 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2016-08-17 15:47:29 +08:00
|
|
|
<Table
|
|
|
|
columns={columns}
|
|
|
|
dataSource={data}
|
|
|
|
bordered
|
2016-10-02 08:38:16 +08:00
|
|
|
title={() => 'Header'}
|
|
|
|
footer={() => 'Footer'}
|
2022-04-03 23:27:45 +08:00
|
|
|
/>
|
2018-11-28 15:00:03 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|