mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 08:59:15 +08:00
e7aa014c31
* docs: init * chore: all types * docs: faq * chore: fix lint
45 lines
834 B
TypeScript
45 lines
834 B
TypeScript
import React from 'react';
|
|
import { Table } from 'antd';
|
|
import type { TableColumnsType } from 'antd';
|
|
|
|
interface DataType {
|
|
key: React.Key;
|
|
name: string;
|
|
age: number;
|
|
address: string;
|
|
}
|
|
|
|
const columns: TableColumnsType<DataType> = [
|
|
{
|
|
title: 'Name (all screens)',
|
|
dataIndex: 'name',
|
|
key: 'name',
|
|
render: (text) => <a>{text}</a>,
|
|
},
|
|
{
|
|
title: 'Age (medium screen or bigger)',
|
|
dataIndex: 'age',
|
|
key: 'age',
|
|
responsive: ['md'],
|
|
},
|
|
{
|
|
title: 'Address (large screen or bigger)',
|
|
dataIndex: 'address',
|
|
key: 'address',
|
|
responsive: ['lg'],
|
|
},
|
|
];
|
|
|
|
const data: DataType[] = [
|
|
{
|
|
key: '1',
|
|
name: 'John Brown',
|
|
age: 32,
|
|
address: 'New York No. 1 Lake Park',
|
|
},
|
|
];
|
|
|
|
const App: React.FC = () => <Table columns={columns} dataSource={data} />;
|
|
|
|
export default App;
|