chore: update table demo ts type (#38333)

* 虚拟滚动列表中的Parameters<typeof Table>[0]改为泛型传参

虚拟滚动列表中的Parameters<typeof Table>[0]改为泛型传参,可以定义通过datasource定义RecordType的值,而不是object

* Update virtual-list.md

* docs: virtualtable example use generic instead of 'Parameters[0]'

* Update components/table/demo/virtual-list.md

Co-authored-by: liangjun.chen <liangjun.chen@yunqutech.com>
Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
Optimistic-Chen 2022-11-02 13:21:28 +08:00 committed by GitHub
parent 81864f9b8a
commit 036a2c20a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,13 +14,14 @@ title:
Integrate virtual scroll with `react-window` to achieve a high performance table of 100,000 data.
```tsx
import { Table } from 'antd';
import { Table } from 'antd';
import type { TableProps } from 'antd';
import classNames from 'classnames';
import ResizeObserver from 'rc-resize-observer';
import React, { useEffect, useRef, useState } from 'react';
import { VariableSizeGrid as Grid } from 'react-window';
const VirtualTable = (props: Parameters<typeof Table>[0]) => {
const VirtualTable = <RecordType extends object>(props: TableProps<RecordType>) => {
const { columns, scroll } = props;
const [tableWidth, setTableWidth] = useState(0);