From be653bd8f88dd41e2ccc7a2c66bd299acc506789 Mon Sep 17 00:00:00 2001 From: yiyunwan <48950552+yiyunwan@users.noreply.github.com> Date: Fri, 13 Oct 2023 09:56:05 +0800 Subject: [PATCH] fix: fix collapse and tab props error (#29) --- packages/components/src/form-collapse/index.tsx | 5 ++++- packages/components/src/form-tab/index.tsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/components/src/form-collapse/index.tsx b/packages/components/src/form-collapse/index.tsx index 348530d..1901f4a 100644 --- a/packages/components/src/form-collapse/index.tsx +++ b/packages/components/src/form-collapse/index.tsx @@ -37,11 +37,14 @@ const usePanels = () => { const field = collapseField.query(collapseField.address.concat(name)).take() if (field?.display === 'none' || field?.display === 'hidden') return if (schema['x-component']?.indexOf('CollapsePanel') > -1) { + const key = + field?.componentProps?.key || schema?.['x-component-props']?.key || name panels.push({ name, props: { ...schema?.['x-component-props'], - key: schema?.['x-component-props']?.key || name, + ...field?.componentProps, + key, }, schema, }) diff --git a/packages/components/src/form-tab/index.tsx b/packages/components/src/form-tab/index.tsx index 11ea0a9..a42e431 100644 --- a/packages/components/src/form-tab/index.tsx +++ b/packages/components/src/form-tab/index.tsx @@ -43,11 +43,14 @@ const useTabs = () => { const field = tabsField.query(tabsField.address.concat(name)).take() if (field?.display === 'none' || field?.display === 'hidden') return if (schema['x-component']?.indexOf('TabPane') > -1) { + const key = + field?.componentProps?.key || schema?.['x-component-props']?.key || name tabs.push({ name, props: { - key: schema?.['x-component-props']?.key || name, ...schema?.['x-component-props'], + ...field?.componentProps, + key, }, schema, })