fix: Repair the alignment error problem when label-width is auto and label-position is left

pull/22968/head
wxwzl 2024-09-13 11:29:16 +08:00
parent c345bb453b
commit 5e803ea66d
1 changed files with 5 additions and 1 deletions

View File

@ -17,7 +17,11 @@ export default {
if (autoLabelWidth && autoLabelWidth !== 'auto') {
const marginLeft = parseInt(autoLabelWidth, 10) - this.computedWidth;
if (marginLeft) {
style.marginLeft = marginLeft + 'px';
if(this.elForm.labelPosition === 'left'){
style.marginRight = marginLeft + 'px';
}else{
style.marginLeft = marginLeft + 'px';
}
}
}
return (<div class="el-form-item__label-wrap" style={style}>