From f2eec0f673b0b3955740cc3d02f061010f520178 Mon Sep 17 00:00:00 2001 From: Harvey Wang Date: Mon, 13 May 2024 10:40:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=87=8D=E5=A4=8D=20close=20#2718?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/s2-core/src/utils/export/copy/table-copy.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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); } };