From 4c0b03db7e1853dca1fd780551985a15258c0806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BB=BA=E5=B3=B0?= <645381995@qq.com> Date: Wed, 21 May 2025 12:50:47 +0800 Subject: [PATCH 1/9] feat: fix expanded & sticky --- src/Body/BodyRow.tsx | 6 ++++-- src/Body/index.tsx | 3 +++ src/Table.tsx | 2 ++ src/context/TableContext.tsx | 2 ++ src/interface.ts | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Body/BodyRow.tsx b/src/Body/BodyRow.tsx index 46ca866f8..3e8bff3fa 100644 --- a/src/Body/BodyRow.tsx +++ b/src/Body/BodyRow.tsx @@ -4,7 +4,7 @@ import Cell from '../Cell'; import { responseImmutable } from '../context/TableContext'; import devRenderTimes from '../hooks/useRenderTimes'; import useRowInfo from '../hooks/useRowInfo'; -import type { ColumnType, CustomizeComponent } from '../interface'; +import type { ColumnType, CustomizeComponent, ExpandableConfig } from '../interface'; import ExpandedRow from './ExpandedRow'; import { computedExpandedClassName } from '../utils/expandUtil'; @@ -19,6 +19,7 @@ export interface BodyRowProps { scopeCellComponent: CustomizeComponent; indent?: number; rowKey: React.Key; + expandedRowColSpan?: ExpandableConfig['expandedRowColSpan']; } // ================================================================================== @@ -102,6 +103,7 @@ function BodyRow( rowComponent: RowComponent, cellComponent, scopeCellComponent, + expandedRowColSpan, } = props; const rowInfo = useRowInfo(record, rowKey, index, indent); const { @@ -195,7 +197,7 @@ function BodyRow( prefixCls={prefixCls} component={RowComponent} cellComponent={cellComponent} - colSpan={flattenColumns.length} + colSpan={expandedRowColSpan ?? flattenColumns.length} isEmpty={false} > {expandContent} diff --git a/src/Body/index.tsx b/src/Body/index.tsx index aec12e9d4..78b8b3282 100644 --- a/src/Body/index.tsx +++ b/src/Body/index.tsx @@ -31,6 +31,7 @@ function Body(props: BodyProps) { expandedKeys, childrenColumnName, emptyNode, + expandedRowColSpan, } = useContext(TableContext, [ 'prefixCls', 'getComponent', @@ -40,6 +41,7 @@ function Body(props: BodyProps) { 'expandedKeys', 'childrenColumnName', 'emptyNode', + 'expandedRowColSpan', ]); const flattenData: { record: RecordType; indent: number; index: number }[] = @@ -74,6 +76,7 @@ function Body(props: BodyProps) { cellComponent={tdComponent} scopeCellComponent={thComponent} indent={indent} + expandedRowColSpan={expandedRowColSpan} /> ); }); diff --git a/src/Table.tsx b/src/Table.tsx index f6676abcd..731fcbd24 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -844,6 +844,7 @@ function Table( expandedRowRender: expandableConfig.expandedRowRender, onTriggerExpand, expandIconColumnIndex: expandableConfig.expandIconColumnIndex, + expandedRowColSpan: expandableConfig.expandedRowColSpan, indentSize: expandableConfig.indentSize, allColumnsFixedLeft: flattenColumns.every(col => col.fixed === 'start'), emptyNode, @@ -894,6 +895,7 @@ function Table( expandableConfig.expandedRowRender, onTriggerExpand, expandableConfig.expandIconColumnIndex, + expandableConfig.expandedRowColSpan, expandableConfig.indentSize, emptyNode, diff --git a/src/context/TableContext.tsx b/src/context/TableContext.tsx index cce41f90b..cf604c868 100644 --- a/src/context/TableContext.tsx +++ b/src/context/TableContext.tsx @@ -3,6 +3,7 @@ import type { ColumnsType, ColumnType, Direction, + ExpandableConfig, ExpandableType, ExpandedRowRender, GetComponent, @@ -52,6 +53,7 @@ export interface TableContextProps { expandIcon: RenderExpandIcon; onTriggerExpand: TriggerEventHandler; expandIconColumnIndex: number; + expandedRowColSpan: ExpandableConfig['expandedRowColSpan']; allColumnsFixedLeft: boolean; // Column diff --git a/src/interface.ts b/src/interface.ts index 54ebfcd97..021195f97 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -256,6 +256,7 @@ export interface ExpandableConfig { rowExpandable?: (record: RecordType) => boolean; columnWidth?: number | string; fixed?: FixedType; + expandedRowColSpan?: number; } // =================== Render =================== From 65cdf0b55d97aa9b9bc05bcc105dd1c37b16c372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BB=BA=E5=B3=B0?= <645381995@qq.com> Date: Wed, 21 May 2025 12:55:00 +0800 Subject: [PATCH 2/9] feat: fix expanded & sticky --- docs/demo/expandedSticky.md | 8 +++++ docs/examples/expandedSticky.tsx | 50 ++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 docs/demo/expandedSticky.md create mode 100644 docs/examples/expandedSticky.tsx diff --git a/docs/demo/expandedSticky.md b/docs/demo/expandedSticky.md new file mode 100644 index 000000000..df58f5783 --- /dev/null +++ b/docs/demo/expandedSticky.md @@ -0,0 +1,8 @@ +--- +title: expandedSticky +nav: + title: Demo + path: /demo +--- + + diff --git a/docs/examples/expandedSticky.tsx b/docs/examples/expandedSticky.tsx new file mode 100644 index 000000000..d6fe6bd94 --- /dev/null +++ b/docs/examples/expandedSticky.tsx @@ -0,0 +1,50 @@ +import React, { useState } from 'react'; +import type { ColumnType } from 'rc-table'; +import Table from 'rc-table'; +import '../../assets/index.less'; + +const Demo = () => { + const [expandedRowKeys, setExpandedRowKeys] = useState([]); + + const columns: ColumnType>[] = [ + { + title: '手机号', + dataIndex: 'a', + width: 100, + onCell: (_, index) => { + const props: React.TdHTMLAttributes = {}; + if (index === 1) props.rowSpan = expandedRowKeys.includes('b') ? 3 : 2; + if (index === 2) props.rowSpan = 0; + return props; + }, + }, + Table.EXPAND_COLUMN, + { title: 'Name', dataIndex: 'c', width: 100 }, + { title: 'Address', dataIndex: 'd', width: 200 }, + ]; + + return ( +
+

expanded & sticky

+ > + rowKey="key" + sticky + columns={columns} + data={[ + { key: 'a', a: '12313132132', c: '小二', d: '文零西路' }, + { key: 'b', a: '13812340987', c: '张三', d: '文一西路' }, + { key: 'c', a: '13812340987', c: '张夫', d: '文二西路' }, + ]} + expandable={{ + expandedRowColSpan: columns.length - 1, + expandedRowKeys, + onExpandedRowsChange: keys => setExpandedRowKeys(keys), + expandedRowRender: record =>

{record.key}

, + }} + className="table" + /> +
+ ); +}; + +export default Demo; From e7f477a0c42bb8d7701031cf05a4e998d3553ba1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BB=BA=E5=B3=B0?= <645381995@qq.com> Date: Wed, 21 May 2025 15:10:18 +0800 Subject: [PATCH 3/9] feat: test --- docs/examples/expandedSticky.tsx | 14 ++++++++++---- docs/examples/fixedColumnsAndHeader.tsx | 2 +- src/Body/BodyRow.tsx | 15 ++++++++++++--- src/Body/ExpandedRow.tsx | 6 ++++-- src/Body/index.tsx | 6 +++--- src/Table.tsx | 4 ++-- src/context/TableContext.tsx | 2 +- src/interface.ts | 2 +- 8 files changed, 34 insertions(+), 17 deletions(-) diff --git a/docs/examples/expandedSticky.tsx b/docs/examples/expandedSticky.tsx index d6fe6bd94..722f81507 100644 --- a/docs/examples/expandedSticky.tsx +++ b/docs/examples/expandedSticky.tsx @@ -11,6 +11,7 @@ const Demo = () => { title: '手机号', dataIndex: 'a', width: 100, + fixed: 'left', onCell: (_, index) => { const props: React.TdHTMLAttributes = {}; if (index === 1) props.rowSpan = expandedRowKeys.includes('b') ? 3 : 2; @@ -19,16 +20,21 @@ const Demo = () => { }, }, Table.EXPAND_COLUMN, - { title: 'Name', dataIndex: 'c', width: 100 }, - { title: 'Address', dataIndex: 'd', width: 200 }, + { title: 'Name', dataIndex: 'c' }, + { title: 'Address', fixed: 'right', dataIndex: 'd', width: 200 }, ]; return ( -
+

expanded & sticky

> rowKey="key" sticky + scroll={{ x: 800 }} columns={columns} data={[ { key: 'a', a: '12313132132', c: '小二', d: '文零西路' }, @@ -36,7 +42,7 @@ const Demo = () => { { key: 'c', a: '13812340987', c: '张夫', d: '文二西路' }, ]} expandable={{ - expandedRowColSpan: columns.length - 1, + expandedRowOffset: 1, expandedRowKeys, onExpandedRowsChange: keys => setExpandedRowKeys(keys), expandedRowRender: record =>

{record.key}

, diff --git a/docs/examples/fixedColumnsAndHeader.tsx b/docs/examples/fixedColumnsAndHeader.tsx index 022658c90..b2c1c6ee6 100644 --- a/docs/examples/fixedColumnsAndHeader.tsx +++ b/docs/examples/fixedColumnsAndHeader.tsx @@ -61,7 +61,7 @@ const columns = [ const Demo = () => ( - +
); diff --git a/src/Body/BodyRow.tsx b/src/Body/BodyRow.tsx index 3e8bff3fa..72a171076 100644 --- a/src/Body/BodyRow.tsx +++ b/src/Body/BodyRow.tsx @@ -19,7 +19,7 @@ export interface BodyRowProps { scopeCellComponent: CustomizeComponent; indent?: number; rowKey: React.Key; - expandedRowColSpan?: ExpandableConfig['expandedRowColSpan']; + expandedRowOffset?: ExpandableConfig['expandedRowOffset']; } // ================================================================================== @@ -103,7 +103,7 @@ function BodyRow( rowComponent: RowComponent, cellComponent, scopeCellComponent, - expandedRowColSpan, + expandedRowOffset = 0, } = props; const rowInfo = useRowInfo(record, rowKey, index, indent); const { @@ -186,6 +186,14 @@ function BodyRow( if (rowSupportExpand && (expandedRef.current || expanded)) { const expandContent = expandedRowRender(record, index, indent + 1, expanded); + const offsetColumns = flattenColumns.filter((_, idx) => idx < expandedRowOffset); + let offsetWidth = 0; + offsetColumns.forEach(item => { + if (typeof item.width === 'number') { + offsetWidth = offsetWidth + (item.width ?? 0); + } + }); + expandRowNode = ( ( prefixCls={prefixCls} component={RowComponent} cellComponent={cellComponent} - colSpan={expandedRowColSpan ?? flattenColumns.length} + offsetWidth={offsetWidth} + colSpan={flattenColumns.length - expandedRowOffset} isEmpty={false} > {expandContent} diff --git a/src/Body/ExpandedRow.tsx b/src/Body/ExpandedRow.tsx index b4009601c..0e014f6d5 100644 --- a/src/Body/ExpandedRow.tsx +++ b/src/Body/ExpandedRow.tsx @@ -14,6 +14,7 @@ export interface ExpandedRowProps { children: React.ReactNode; colSpan: number; isEmpty: boolean; + offsetWidth?: number; } function ExpandedRow(props: ExpandedRowProps) { @@ -30,6 +31,7 @@ function ExpandedRow(props: ExpandedRowProps) { expanded, colSpan, isEmpty, + offsetWidth = 0, } = props; const { scrollbarSize, fixHeader, fixColumn, componentWidth, horizonScroll } = useContext( @@ -39,12 +41,12 @@ function ExpandedRow(props: ExpandedRowProps) { // Cache render node let contentNode = children; - if (isEmpty ? horizonScroll && componentWidth : fixColumn) { + console.log('1', { componentWidth, fixHeader, isEmpty, scrollbarSize }); contentNode = (
(props: BodyProps) { expandedKeys, childrenColumnName, emptyNode, - expandedRowColSpan, + expandedRowOffset, } = useContext(TableContext, [ 'prefixCls', 'getComponent', @@ -41,7 +41,7 @@ function Body(props: BodyProps) { 'expandedKeys', 'childrenColumnName', 'emptyNode', - 'expandedRowColSpan', + 'expandedRowOffset', ]); const flattenData: { record: RecordType; indent: number; index: number }[] = @@ -76,7 +76,7 @@ function Body(props: BodyProps) { cellComponent={tdComponent} scopeCellComponent={thComponent} indent={indent} - expandedRowColSpan={expandedRowColSpan} + expandedRowOffset={expandedRowOffset} /> ); }); diff --git a/src/Table.tsx b/src/Table.tsx index 731fcbd24..273ce2962 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -844,7 +844,7 @@ function Table( expandedRowRender: expandableConfig.expandedRowRender, onTriggerExpand, expandIconColumnIndex: expandableConfig.expandIconColumnIndex, - expandedRowColSpan: expandableConfig.expandedRowColSpan, + expandedRowOffset: expandableConfig.expandedRowOffset, indentSize: expandableConfig.indentSize, allColumnsFixedLeft: flattenColumns.every(col => col.fixed === 'start'), emptyNode, @@ -895,7 +895,7 @@ function Table( expandableConfig.expandedRowRender, onTriggerExpand, expandableConfig.expandIconColumnIndex, - expandableConfig.expandedRowColSpan, + expandableConfig.expandedRowOffset, expandableConfig.indentSize, emptyNode, diff --git a/src/context/TableContext.tsx b/src/context/TableContext.tsx index cf604c868..1ce9cc571 100644 --- a/src/context/TableContext.tsx +++ b/src/context/TableContext.tsx @@ -53,7 +53,7 @@ export interface TableContextProps { expandIcon: RenderExpandIcon; onTriggerExpand: TriggerEventHandler; expandIconColumnIndex: number; - expandedRowColSpan: ExpandableConfig['expandedRowColSpan']; + expandedRowOffset: ExpandableConfig['expandedRowOffset']; allColumnsFixedLeft: boolean; // Column diff --git a/src/interface.ts b/src/interface.ts index 021195f97..dcdfb4f9b 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -256,7 +256,7 @@ export interface ExpandableConfig { rowExpandable?: (record: RecordType) => boolean; columnWidth?: number | string; fixed?: FixedType; - expandedRowColSpan?: number; + expandedRowOffset?: number; } // =================== Render =================== From 3019a32a6d5d99b5eb47af74c9e6c8e6ee0f22c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BB=BA=E5=B3=B0?= <645381995@qq.com> Date: Wed, 21 May 2025 15:11:34 +0800 Subject: [PATCH 4/9] feat: test --- src/Body/ExpandedRow.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Body/ExpandedRow.tsx b/src/Body/ExpandedRow.tsx index 0e014f6d5..aee83c6aa 100644 --- a/src/Body/ExpandedRow.tsx +++ b/src/Body/ExpandedRow.tsx @@ -42,7 +42,6 @@ function ExpandedRow(props: ExpandedRowProps) { // Cache render node let contentNode = children; if (isEmpty ? horizonScroll && componentWidth : fixColumn) { - console.log('1', { componentWidth, fixHeader, isEmpty, scrollbarSize }); contentNode = (
Date: Wed, 21 May 2025 17:52:28 +0800 Subject: [PATCH 5/9] feat: reset demo --- docs/examples/fixedColumnsAndHeader.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/examples/fixedColumnsAndHeader.tsx b/docs/examples/fixedColumnsAndHeader.tsx index b2c1c6ee6..022658c90 100644 --- a/docs/examples/fixedColumnsAndHeader.tsx +++ b/docs/examples/fixedColumnsAndHeader.tsx @@ -61,7 +61,7 @@ const columns = [ const Demo = () => ( -
+
); From f159a581795aa074749ae742aae54a35bf2ae3e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BB=BA=E5=B3=B0?= <645381995@qq.com> Date: Sat, 24 May 2025 13:01:04 +0800 Subject: [PATCH 6/9] feat: reset --- docs/examples/className.tsx | 2 +- src/Body/index.tsx | 3 --- src/Panel/index.tsx | 6 +----- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/docs/examples/className.tsx b/docs/examples/className.tsx index 77c32e227..8deffd2b1 100644 --- a/docs/examples/className.tsx +++ b/docs/examples/className.tsx @@ -56,7 +56,7 @@ const Demo = () => ( footer={() => footer} />

scroll

-
`row-${i}`} expandedRowRender={record =>

extra: {record.a}

} diff --git a/src/Body/index.tsx b/src/Body/index.tsx index 2e2b849ff..4d41da45a 100644 --- a/src/Body/index.tsx +++ b/src/Body/index.tsx @@ -32,7 +32,6 @@ function Body(props: BodyProps) { expandedKeys, childrenColumnName, emptyNode, - expandedRowOffset, classNames, styles, } = useContext(TableContext, [ @@ -44,7 +43,6 @@ function Body(props: BodyProps) { 'expandedKeys', 'childrenColumnName', 'emptyNode', - 'expandedRowOffset', 'classNames', 'styles', ]); @@ -85,7 +83,6 @@ function Body(props: BodyProps) { cellComponent={tdComponent} scopeCellComponent={thComponent} indent={indent} - expandedRowOffset={expandedRowOffset} /> ); }); diff --git a/src/Panel/index.tsx b/src/Panel/index.tsx index c68a7d371..3cd57e21e 100644 --- a/src/Panel/index.tsx +++ b/src/Panel/index.tsx @@ -7,11 +7,7 @@ export interface TitleProps { } function Panel({ className, style, children }: TitleProps) { - return ( -
- {children} -
- ); + return
{children}
; } export default Panel; From 26db737ca03bbd5aeef437ebd7580ab3a52331c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BB=BA=E5=B3=B0?= <645381995@qq.com> Date: Sat, 24 May 2025 13:04:39 +0800 Subject: [PATCH 7/9] feat: reset --- docs/examples/expandedSticky.tsx | 6 +----- src/Body/index.tsx | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/examples/expandedSticky.tsx b/docs/examples/expandedSticky.tsx index 722f81507..e17df153b 100644 --- a/docs/examples/expandedSticky.tsx +++ b/docs/examples/expandedSticky.tsx @@ -25,11 +25,7 @@ const Demo = () => { ]; return ( -
+

expanded & sticky

> rowKey="key" diff --git a/src/Body/index.tsx b/src/Body/index.tsx index 4d41da45a..d35f7cfb6 100644 --- a/src/Body/index.tsx +++ b/src/Body/index.tsx @@ -34,6 +34,7 @@ function Body(props: BodyProps) { emptyNode, classNames, styles, + expandedRowOffset, } = useContext(TableContext, [ 'prefixCls', 'getComponent', @@ -45,6 +46,7 @@ function Body(props: BodyProps) { 'emptyNode', 'classNames', 'styles', + 'expandedRowOffset', ]); const { body: bodyCls = {} } = classNames || {}; const { body: bodyStyles = {} } = styles || {}; @@ -83,6 +85,7 @@ function Body(props: BodyProps) { cellComponent={tdComponent} scopeCellComponent={thComponent} indent={indent} + expandedRowOffset={expandedRowOffset} /> ); }); From 1dc05b8c1c8b31a4c551ea4a2f9836a2d4a2d2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BB=BA=E5=B3=B0?= <645381995@qq.com> Date: Sat, 24 May 2025 14:02:36 +0800 Subject: [PATCH 8/9] feat: test --- docs/examples/expandedSticky.tsx | 45 +++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/docs/examples/expandedSticky.tsx b/docs/examples/expandedSticky.tsx index e17df153b..d491ae9fa 100644 --- a/docs/examples/expandedSticky.tsx +++ b/docs/examples/expandedSticky.tsx @@ -3,9 +3,34 @@ import type { ColumnType } from 'rc-table'; import Table from 'rc-table'; import '../../assets/index.less'; +// 合并单元格 +export const getRowSpan = (source: (string | number | undefined)[] = []) => { + const list: { rowSpan?: number }[] = []; + let span = 0; + source.reverse().forEach((key, index) => { + span = span + 1; + if (key !== source[index + 1]) { + list.push({ rowSpan: span }); + span = 0; + } else { + list.push({ rowSpan: 0 }); + } + }); + return list.reverse(); +}; + const Demo = () => { const [expandedRowKeys, setExpandedRowKeys] = useState([]); + const data = [ + { key: 'a', a: '1', c: '小二', d: '文零西路' }, + { key: 'b', a: '2', c: '张三', d: '文一西路' }, + { key: 'c', a: '2', c: '张夫', d: '文二西路' }, + ]; + const rowKeys = data.map(item => item.key); + + const rowSpanList = getRowSpan(data.map(item => item.a)); + const columns: ColumnType>[] = [ { title: '手机号', @@ -13,9 +38,19 @@ const Demo = () => { width: 100, fixed: 'left', onCell: (_, index) => { + const { rowSpan = 1 } = rowSpanList[index]; const props: React.TdHTMLAttributes = {}; - if (index === 1) props.rowSpan = expandedRowKeys.includes('b') ? 3 : 2; - if (index === 2) props.rowSpan = 0; + props.rowSpan = rowSpan; + if (rowSpan >= 1) { + let currentRowSpan = rowSpan; + for (let i = index; i < index + rowSpan; i += 1) { + const rowKey = rowKeys[i]; + if (expandedRowKeys.includes(rowKey)) { + currentRowSpan += 1; + } + } + props.rowSpan = currentRowSpan; + } return props; }, }, @@ -32,11 +67,7 @@ const Demo = () => { sticky scroll={{ x: 800 }} columns={columns} - data={[ - { key: 'a', a: '12313132132', c: '小二', d: '文零西路' }, - { key: 'b', a: '13812340987', c: '张三', d: '文一西路' }, - { key: 'c', a: '13812340987', c: '张夫', d: '文二西路' }, - ]} + data={data} expandable={{ expandedRowOffset: 1, expandedRowKeys, From 1e9da7a2f14e53050401630da75b2dbcc42167ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=BB=BA=E5=B3=B0?= <645381995@qq.com> Date: Sat, 24 May 2025 14:16:34 +0800 Subject: [PATCH 9/9] feat: test --- docs/examples/expandedSticky.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/examples/expandedSticky.tsx b/docs/examples/expandedSticky.tsx index d491ae9fa..c55aa7534 100644 --- a/docs/examples/expandedSticky.tsx +++ b/docs/examples/expandedSticky.tsx @@ -23,9 +23,9 @@ const Demo = () => { const [expandedRowKeys, setExpandedRowKeys] = useState([]); const data = [ - { key: 'a', a: '1', c: '小二', d: '文零西路' }, - { key: 'b', a: '2', c: '张三', d: '文一西路' }, - { key: 'c', a: '2', c: '张夫', d: '文二西路' }, + { key: 'a', a: '小二', d: '文零西路' }, + { key: 'b', a: '张三', d: '文一西路' }, + { key: 'c', a: '张三', d: '文二西路' }, ]; const rowKeys = data.map(item => item.key); @@ -55,7 +55,6 @@ const Demo = () => { }, }, Table.EXPAND_COLUMN, - { title: 'Name', dataIndex: 'c' }, { title: 'Address', fixed: 'right', dataIndex: 'd', width: 200 }, ];