From 263e7c386b20835fade8467375d65146cc324ef3 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 28 Feb 2022 21:44:15 +0800 Subject: [PATCH] fix: table dynamic expand error, close #5295 --- components/vc-table/Body/BodyRow.tsx | 43 ++++++++++++---------------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/components/vc-table/Body/BodyRow.tsx b/components/vc-table/Body/BodyRow.tsx index d3ee09ed0..31e959045 100644 --- a/components/vc-table/Body/BodyRow.tsx +++ b/components/vc-table/Body/BodyRow.tsx @@ -147,7 +147,24 @@ export default defineComponent>({ if (column.customCell) { additionalCellProps = column.customCell(record, index, column); } - + // not use slot to fix https://github.com/vueComponent/ant-design-vue/issues/5295 + const appendNode = + colIndex === (expandIconColumnIndex || 0) && nestExpandable.value ? ( + <> + + {expandIcon({ + prefixCls, + expanded: expanded.value, + expandable: hasNestChildren.value, + record, + onExpand: onInternalTriggerExpand, + })} + + ) : null; return ( >({ additionalProps={additionalCellProps} column={column} transformCellText={transformCellText} - v-slots={{ - // ============= Used for nest expandable ============= - appendNode: - colIndex === (expandIconColumnIndex || 0) && nestExpandable.value - ? () => { - return ( - <> - - {expandIcon({ - prefixCls, - expanded: expanded.value, - expandable: hasNestChildren.value, - record, - onExpand: onInternalTriggerExpand, - })} - - ); - } - : undefined, - }} + appendNode={appendNode} /> ); })}