diff --git a/packages/form/src/form.vue b/packages/form/src/form.vue index 23a6d24b..d9e6e612 100644 --- a/packages/form/src/form.vue +++ b/packages/form/src/form.vue @@ -56,6 +56,7 @@ }, computed: { autoLabelWidth() { + if (!this.potentialLabelWidthArr.length) return 0; const max = Math.max(...this.potentialLabelWidthArr); return max ? `${max}px` : ''; } diff --git a/packages/form/src/label-wrap.vue b/packages/form/src/label-wrap.vue index 9a844bc3..d263f7dd 100644 --- a/packages/form/src/label-wrap.vue +++ b/packages/form/src/label-wrap.vue @@ -15,7 +15,10 @@ export default { const autoLabelWidth = this.elForm.autoLabelWidth; const style = {}; if (autoLabelWidth && autoLabelWidth !== 'auto') { - style.width = autoLabelWidth; + const marginLeft = parseInt(autoLabelWidth, 10) - this.computedWidth; + if (marginLeft) { + style.marginLeft = marginLeft + 'px'; + } } return (