From e8dd7a89afa5c0b00b8bbecfcb694d89025dd9bc Mon Sep 17 00:00:00 2001 From: Song Mingxu Date: Fri, 21 Feb 2025 14:09:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(card):=20=E4=BF=AE=E5=A4=8D=20Card=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=B8=AD=20actions=20=E5=92=8C=20toolbar=20?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=20dropdown-button=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98=20(#11605)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 渲染 toolbar 和 actions 时,在传入 subProps 中指定 onClick 为 undefined - 避免 Cards 中为 Cards 功能特性增加的点击处理函数意外传给 Card 的 toolbar 和 actions - 修复 renderField 拼写错误 Co-authored-by: Song Mingxu --- packages/amis/src/renderers/Card.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/amis/src/renderers/Card.tsx b/packages/amis/src/renderers/Card.tsx index ea0dca74116..89368e31d86 100644 --- a/packages/amis/src/renderers/Card.tsx +++ b/packages/amis/src/renderers/Card.tsx @@ -416,7 +416,8 @@ export class CardRenderer extends React.Component { ...(action as any) }, { - key: index + key: index, + onClick: undefined } ) ) @@ -481,7 +482,8 @@ export class CardRenderer extends React.Component { } ), componentClass: 'a', - onAction: this.handleAction + onAction: this.handleAction, + onClick: undefined } ); })} @@ -511,14 +513,14 @@ export class CardRenderer extends React.Component { }) as JSX.Element; } - return this.renderFeild(region, childNode, key, this.props); + return this.renderField(region, childNode, key, this.props); } itemRender(field: any, index: number, props: any) { - return this.renderFeild(`column/${index}`, field, index, props); + return this.renderField(`column/${index}`, field, index, props); } - renderFeild(region: string, field: Schema, key: any, props: any) { + renderField(region: string, field: Schema, key: any, props: any) { const {render, classnames: cx, itemIndex} = props; const useCardLabel = props?.useCardLabel !== false; const data = this.props.data;