mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 01:19:45 +08:00
44 lines
768 B
TypeScript
44 lines
768 B
TypeScript
|
import React from 'react';
|
||
|
import { Table } from 'antd';
|
||
|
import type { ColumnsType } from 'antd/es/table';
|
||
|
|
||
|
interface DataType {
|
||
|
key: React.Key;
|
||
|
name: string;
|
||
|
age: number;
|
||
|
address: string;
|
||
|
}
|
||
|
|
||
|
const columns: ColumnsType<DataType> = [
|
||
|
{
|
||
|
title: 'Name',
|
||
|
dataIndex: 'name',
|
||
|
width: 150,
|
||
|
},
|
||
|
{
|
||
|
title: 'Age',
|
||
|
dataIndex: 'age',
|
||
|
width: 150,
|
||
|
},
|
||
|
{
|
||
|
title: 'Address',
|
||
|
dataIndex: 'address',
|
||
|
},
|
||
|
];
|
||
|
|
||
|
const data: DataType[] = [];
|
||
|
for (let i = 0; i < 100; i++) {
|
||
|
data.push({
|
||
|
key: i,
|
||
|
name: `Edward King ${i}`,
|
||
|
age: 32,
|
||
|
address: `London, Park Lane no. ${i}`,
|
||
|
});
|
||
|
}
|
||
|
|
||
|
const App: React.FC = () => (
|
||
|
<Table columns={columns} dataSource={data} pagination={{ pageSize: 50 }} scroll={{ y: 240 }} />
|
||
|
);
|
||
|
|
||
|
export default App;
|