From bf4ba3f0757a5414f21be36914cf84e0d74a717a Mon Sep 17 00:00:00 2001 From: "zhili.wzl" Date: Thu, 14 Oct 2021 15:41:03 +0800 Subject: [PATCH] fix(react): fix CompositePanel --- packages/react/src/panels/CompositePanel.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/react/src/panels/CompositePanel.tsx b/packages/react/src/panels/CompositePanel.tsx index 740b15900..deeb8e522 100644 --- a/packages/react/src/panels/CompositePanel.tsx +++ b/packages/react/src/panels/CompositePanel.tsx @@ -152,16 +152,17 @@ export const CompositePanel: React.FC & { key={index} href={item.href} onClick={(e: any) => { + const key = item.key ?? index if (shape === 'tab') { if (activeKey === index || activeKey === item.key) { setVisible(!visible) } else { setVisible(true) } - setActiveKey(index) + setActiveKey(key) } item.onClick?.(e) - props.onChange?.(item.key ?? index) + props.onChange?.(key) }} > {takeTab()}