diff --git a/packages/components/table/src/table-body/render-helper.ts b/packages/components/table/src/table-body/render-helper.ts index 9e420d5ee3..419fe87b5c 100644 --- a/packages/components/table/src/table-body/render-helper.ts +++ b/packages/components/table/src/table-body/render-helper.ts @@ -32,6 +32,7 @@ function useRender(props: Partial>) { getCellClass, getSpan, getColspanRealWidth, + isColumnHidden, } = useStyles(props) const firstDefaultColumnIndex = computed(() => { return props.store.states.columns.value.findIndex( @@ -107,6 +108,7 @@ function useRender(props: Partial>) { } const baseKey = `${$index},${cellIndex}` const patchKey = columnData.columnKey || columnData.rawColumnKey || '' + const tdChildren = cellChildren(cellIndex, column, data) return h( 'td', { @@ -119,11 +121,14 @@ function useRender(props: Partial>) { handleCellMouseEnter($event, { ...row, tooltipEffect }), onMouseleave: handleCellMouseLeave, }, - [column.renderCell(data)] + [tdChildren] ) }) ) } + const cellChildren = (cellIndex, column, data) => { + return isColumnHidden(cellIndex) ? null : column.renderCell(data) + } const wrappedRowRender = (row: T, $index: number) => { const store = props.store const { isRowExpanded, assertRowKey } = store