diff --git a/packages/components/virtual-list/src/builders/build-grid.ts b/packages/components/virtual-list/src/builders/build-grid.ts index 8cc6293d17..2d67efd02a 100644 --- a/packages/components/virtual-list/src/builders/build-grid.ts +++ b/packages/components/virtual-list/src/builders/build-grid.ts @@ -1,5 +1,6 @@ // @ts-nocheck import { + Fragment, computed, defineComponent, getCurrentInstance, @@ -595,17 +596,21 @@ const createGrid = ({ if (totalRow > 0 && totalColumn > 0) { for (let row = rowStart; row <= rowEnd; row++) { for (let column = columnStart; column <= columnEnd; column++) { + const key = itemKey({ columnIndex: column, data, rowIndex: row }) children.push( - slots.default?.({ - columnIndex: column, - data, - key: itemKey({ columnIndex: column, data, rowIndex: row }), - isScrolling: useIsScrolling - ? unref(states).isScrolling - : undefined, - style: getItemStyle(row, column), - rowIndex: row, - }) + h( + Fragment, + { key }, + slots.default?.({ + columnIndex: column, + data, + isScrolling: useIsScrolling + ? unref(states).isScrolling + : undefined, + style: getItemStyle(row, column), + rowIndex: row, + }) + ) ) } } diff --git a/packages/components/virtual-list/src/builders/build-list.ts b/packages/components/virtual-list/src/builders/build-list.ts index 90636757bb..5ed8cfc45c 100644 --- a/packages/components/virtual-list/src/builders/build-list.ts +++ b/packages/components/virtual-list/src/builders/build-list.ts @@ -1,5 +1,6 @@ // @ts-nocheck import { + Fragment, computed, defineComponent, getCurrentInstance, @@ -484,13 +485,16 @@ const createList = ({ if (total > 0) { for (let i = start; i <= end; i++) { children.push( - ($slots.default as Slot)?.({ - data, - key: i, - index: i, - isScrolling: useIsScrolling ? states.isScrolling : undefined, - style: getItemStyle(i), - }) + h( + Fragment, + { key: i }, + ($slots.default as Slot)?.({ + data, + index: i, + isScrolling: useIsScrolling ? states.isScrolling : undefined, + style: getItemStyle(i), + }) + ) ) } }