diff --git a/packages/s2-core/src/utils/export/copy/table-copy.ts b/packages/s2-core/src/utils/export/copy/table-copy.ts index 60f045f527..d7178a6aee 100644 --- a/packages/s2-core/src/utils/export/copy/table-copy.ts +++ b/packages/s2-core/src/utils/export/copy/table-copy.ts @@ -131,15 +131,22 @@ class TableDataCellCopy extends BaseDataCellCopy { row.push(dataItem as string); } - rowIndex = j; + // 生成一行数据后,rowIndex + 1,下次 requestIdleCallback 时从下一行开始 + rowIndex++; result.push(row); count--; } } - if (rowIndex === rowLength - 1) { + if (rowIndex === rowLength) { resolve(result); } else { + // 重置 count,避免下次 requestIdleCallback 时 count 为 0 + count = + rowLength >= AsyncRenderThreshold + ? AsyncRenderThreshold + : rowLength; + requestIdleCallback(dataMatrixIdleCallback); } };