2023-07-28 16:17:43 +08:00
|
|
|
import React from 'react';
|
2023-04-06 17:16:27 +08:00
|
|
|
import { Table } from 'antd';
|
2024-01-11 15:55:58 +08:00
|
|
|
import type { TableColumnsType } from 'antd';
|
2023-04-06 17:16:27 +08:00
|
|
|
|
|
|
|
interface DataType {
|
|
|
|
key: React.Key;
|
|
|
|
name: string;
|
|
|
|
age: number;
|
|
|
|
address: string;
|
|
|
|
}
|
|
|
|
|
2024-01-11 15:55:58 +08:00
|
|
|
const columns: TableColumnsType<DataType> = [
|
2023-04-06 17:16:27 +08:00
|
|
|
{
|
|
|
|
title: 'Name',
|
|
|
|
dataIndex: 'name',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Age',
|
|
|
|
dataIndex: 'age',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Address',
|
|
|
|
dataIndex: 'address',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const data: DataType[] = [
|
|
|
|
{
|
|
|
|
key: '1',
|
|
|
|
name: 'John Brown',
|
|
|
|
age: 32,
|
|
|
|
address: 'New York No. 1 Lake Park',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '2',
|
|
|
|
name: 'Jim Green',
|
|
|
|
age: 42,
|
|
|
|
address: 'London No. 1 Lake Park',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: '3',
|
|
|
|
name: 'Joe Black',
|
|
|
|
age: 32,
|
|
|
|
address: 'Sydney No. 1 Lake Park',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const App: React.FC = () => (
|
|
|
|
<Table
|
|
|
|
bordered
|
|
|
|
rowSelection={{ type: 'checkbox', selections: true }}
|
|
|
|
columns={columns}
|
|
|
|
dataSource={data}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default App;
|