From a7b2f14b900771186ee126cf60e8841ecc0cb8c1 Mon Sep 17 00:00:00 2001 From: xachary <179740385@qq.com> Date: Mon, 25 Dec 2023 17:15:39 +0800 Subject: [PATCH] fix(BasicTable): keep rowSelection onChange call outside (#3461). resolve #3453 --- src/components/Table/src/hooks/useRowSelection.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Table/src/hooks/useRowSelection.ts b/src/components/Table/src/hooks/useRowSelection.ts index 1357dc361aa..c940e783905 100644 --- a/src/components/Table/src/hooks/useRowSelection.ts +++ b/src/components/Table/src/hooks/useRowSelection.ts @@ -22,8 +22,10 @@ export function useRowSelection( return { selectedRowKeys: unref(selectedRowKeysRef), - onChange: (selectedRowKeys: Key[]) => { + onChange: (selectedRowKeys: Key[], selectedRows: any[]) => { setSelectedRowKeys(selectedRowKeys); + // 维持外部定义的onChange回调 + rowSelection.onChange?.(selectedRowKeys, selectedRows); }, ...omit(rowSelection, ['onChange']), };