fix: table dynamic expand error, close #5295
parent
78c436b990
commit
be7a73a7e6
|
@ -147,7 +147,24 @@ export default defineComponent<BodyRowProps<unknown>>({
|
||||||
if (column.customCell) {
|
if (column.customCell) {
|
||||||
additionalCellProps = column.customCell(record, index, column);
|
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 ? (
|
||||||
|
<>
|
||||||
|
<span
|
||||||
|
data-test={colIndex}
|
||||||
|
style={{ paddingLeft: `${indentSize * indent}px` }}
|
||||||
|
class={`${prefixCls}-row-indent indent-level-${indent}`}
|
||||||
|
/>
|
||||||
|
{expandIcon({
|
||||||
|
prefixCls,
|
||||||
|
expanded: expanded.value,
|
||||||
|
expandable: hasNestChildren.value,
|
||||||
|
record,
|
||||||
|
onExpand: onInternalTriggerExpand,
|
||||||
|
})}
|
||||||
|
</>
|
||||||
|
) : null;
|
||||||
return (
|
return (
|
||||||
<Cell
|
<Cell
|
||||||
cellType="body"
|
cellType="body"
|
||||||
|
@ -165,29 +182,7 @@ export default defineComponent<BodyRowProps<unknown>>({
|
||||||
additionalProps={additionalCellProps}
|
additionalProps={additionalCellProps}
|
||||||
column={column}
|
column={column}
|
||||||
transformCellText={transformCellText}
|
transformCellText={transformCellText}
|
||||||
v-slots={{
|
appendNode={appendNode}
|
||||||
// ============= Used for nest expandable =============
|
|
||||||
appendNode:
|
|
||||||
colIndex === (expandIconColumnIndex || 0) && nestExpandable.value
|
|
||||||
? () => {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<span
|
|
||||||
style={{ paddingLeft: `${indentSize * indent}px` }}
|
|
||||||
class={`${prefixCls}-row-indent indent-level-${indent}`}
|
|
||||||
/>
|
|
||||||
{expandIcon({
|
|
||||||
prefixCls,
|
|
||||||
expanded: expanded.value,
|
|
||||||
expandable: hasNestChildren.value,
|
|
||||||
record,
|
|
||||||
onExpand: onInternalTriggerExpand,
|
|
||||||
})}
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
Loading…
Reference in New Issue