From 5ad5c8cdc7df4454fb16df115180b477b4e44fe3 Mon Sep 17 00:00:00 2001 From: LanceJiang Date: Thu, 29 Jun 2023 21:04:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=B1=BB=E4=BC=BC=20/comp/table/formTab?= =?UTF-8?q?le=E9=A1=B5=E9=9D=A2=20rowSelection.selectedRowKeys=20=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8F=8C=E5=90=91=E7=BB=91=E5=AE=9A=E6=97=B6=20clickT?= =?UTF-8?q?oRowSelect=20RowClick=20=E8=A7=A6=E5=8F=91=E5=A4=B1=E6=95=88=20?= =?UTF-8?q?(#2893)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Table/src/hooks/useCustomRow.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Table/src/hooks/useCustomRow.ts b/src/components/Table/src/hooks/useCustomRow.ts index 1a5aac85..0f7a6ea0 100644 --- a/src/components/Table/src/hooks/useCustomRow.ts +++ b/src/components/Table/src/hooks/useCustomRow.ts @@ -42,7 +42,7 @@ export function useCustomRow( if (!rowSelection || !clickToRowSelect) return; const keys = getSelectRowKeys() || []; const key = getKey(record, rowKey, unref(getAutoCreateKey)); - if (!key) return; + if (key === null) return; const isCheckbox = rowSelection.type === 'checkbox'; if (isCheckbox) { @@ -55,7 +55,8 @@ export function useCustomRow( const checkBox = tr.querySelector('input[type=checkbox]'); if (!checkBox || checkBox.hasAttribute('disabled')) return; if (!keys.includes(key)) { - setSelectedRowKeys([...keys, key]); + keys.push(key); + setSelectedRowKeys(keys); return; } const keyIndex = keys.findIndex((item) => item === key);