mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 03:22:59 +08:00
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:
parent
81864f9b8a
commit
036a2c20a1
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user