Skip to content

Commit

Permalink
fix(card): 修复 Card 组件中 actions 和 toolbar 中的 dropdown-button 组件失效的问题 (#…
Browse files Browse the repository at this point in the history
…11605)

- 渲染 toolbar 和 actions 时,在传入 subProps 中指定 onClick 为 undefined
- 避免 Cards 中为 Cards 功能特性增加的点击处理函数意外传给 Card 的 toolbar 和 actions
- 修复 renderField 拼写错误

Co-authored-by: Song Mingxu <mingxu.song@gmail.com>
  • Loading branch information
BeMxself and Song Mingxu authored Feb 21, 2025
1 parent c51260e commit e8dd7a8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/amis/src/renderers/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ export class CardRenderer extends React.Component<CardProps> {
...(action as any)
},
{
key: index
key: index,
onClick: undefined
}
)
)
Expand Down Expand Up @@ -481,7 +482,8 @@ export class CardRenderer extends React.Component<CardProps> {
}
),
componentClass: 'a',
onAction: this.handleAction
onAction: this.handleAction,
onClick: undefined
}
);
})}
Expand Down Expand Up @@ -511,14 +513,14 @@ export class CardRenderer extends React.Component<CardProps> {
}) 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;
Expand Down

0 comments on commit e8dd7a8

Please sign in to comment.