import React, { useState } from 'react'; import { Card, Menu, Descriptions } from 'antd'; import type { ProColumns } from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table'; import { MailOutlined } from '@ant-design/icons'; const waitTime = (time: number = 100) => { return new Promise((resolve) => { setTimeout(() => { resolve(true); }, time); }); }; export type TableListItem = { key: number; name: string; createdAt: number; progress: number; }; const tableListDataSource: TableListItem[] = []; for (let i = 0; i < 2; i += 1) { tableListDataSource.push({ key: i, name: `TradeCode ${i}`, createdAt: Date.now() - Math.floor(Math.random() * 2000), progress: Math.ceil(Math.random() * 100) + 1, }); } const columns: ProColumns[] = [ { title: '序号', dataIndex: 'index', valueType: 'index', width: 80, }, { title: '更新时间', key: 'since2', dataIndex: 'createdAt', valueType: 'date', }, { title: '执行进度', dataIndex: 'progress', valueType: 'progress', }, ]; export default () => { const [key, setKey] = useState('1'); return ( columns={columns} rowKey="key" pagination={{ showSizeChanger: true, }} tableRender={(_, dom) => (
setKey(e.key as string)} style={{ width: 256 }} defaultSelectedKeys={['1']} defaultOpenKeys={['sub1']} mode="inline" > Navigation One } > Option 1 Option 2 Option 3 Option 4
{dom}
)} tableExtraRender={(_, data) => ( {data.length} Lili Qu 421421 2017-01-10 2017-10-10 )} params={{ key, }} request={async () => { await waitTime(200); return { success: true, data: tableListDataSource, }; }} dateFormatter="string" headerTitle="自定义表格主体" /> ); };