Skip to content

Commit

Permalink
fix(form): 修复渲染多余 label 节点问题 (#2240)
Browse files Browse the repository at this point in the history
  • Loading branch information
honkinglin authored Mar 16, 2023
1 parent d79a588 commit 357e658
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/form/form-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ export default mixins(getConfigReceiverMixins<FormItemConstructor, FormConfig>('
const labelWidth = isNil(this.labelWidth) ? parent?.labelWidth : this.labelWidth;
const labelAlign = isNil(this.labelAlign) ? parent?.labelAlign : this.labelAlign;
if (Number(labelWidth) === 0) return;
const labelContent = this.getLabelContent();
if (!labelContent) return null;

let labelStyle = {};
if (labelWidth && labelAlign !== 'top') {
Expand All @@ -355,7 +357,7 @@ export default mixins(getConfigReceiverMixins<FormItemConstructor, FormConfig>('

return (
<div class={this.labelClasses} style={labelStyle}>
<label for={this.for}>{this.getLabelContent()}</label>
<label for={this.for}>{labelContent}</label>
</div>
);
},
Expand Down

0 comments on commit 357e658

Please sign in to comment.