diff --git a/packages/components/table/src/Table.tsx b/packages/components/table/src/Table.tsx index 02bcfe99c..887c27d5c 100644 --- a/packages/components/table/src/Table.tsx +++ b/packages/components/table/src/Table.tsx @@ -186,25 +186,21 @@ export default defineComponent({ const header = <ɵHeader v-slots={slots} header={props.header} /> const footer = renderFooter(slots, prefixCls) + const [paginationTop, paginationBottom] = renderPagination( + slots, + mergedPagination.value, + filteredData.value, + flattedData.value.length > 0, + prefixCls, + ) const children = [header] - let resetChildren = [, footer].filter(Boolean) as VNode[] - - if (flattedData.value.length > 0) { - const [paginationTop, paginationBottom] = renderPagination( - slots, - mergedPagination.value, - filteredData.value, - prefixCls, - ) - - resetChildren = [paginationTop, ...resetChildren, paginationBottom].filter(Boolean) as VNode[] - } + const restChildren = [paginationTop, , footer, paginationBottom].filter(Boolean) as VNode[] const spinProps = convertSpinProps(props.spin) if (spinProps) { - children.push({resetChildren}) + children.push({restChildren}) } else { - children.push(...resetChildren) + children.push(...restChildren) } return
{children}
} diff --git a/packages/components/table/src/other/Pagination.tsx b/packages/components/table/src/other/Pagination.tsx index a33207488..a0aa10a07 100644 --- a/packages/components/table/src/other/Pagination.tsx +++ b/packages/components/table/src/other/Pagination.tsx @@ -17,6 +17,7 @@ export function renderPagination( slots: Slots, mergedPagination: TablePagination | null, filteredData: MergedData[], + visible: boolean, prefixCls: string, ): [VNodeChild | null, VNodeChild | null] { let top: VNodeChild | null = null @@ -28,7 +29,7 @@ export function renderPagination( const className = `${prefixCls}-pagination ${prefixCls}-pagination-${horizontal}` const node = slots.pagination?.({ total: filteredData.length, ...mergedPagination }) ?? ( - + ) top = vertical === 'top' ? node : null