From e9f3d00f0380bd91ab3a4d74005586da977037ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=81=8F?= Date: Mon, 20 Aug 2018 10:14:50 +0800 Subject: [PATCH] fixed Form label bug, close 4289 --- src/components/form/form-item.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/form/form-item.vue b/src/components/form/form-item.vue index ab9362e2..2a687687 100644 --- a/src/components/form/form-item.vue +++ b/src/components/form/form-item.vue @@ -130,16 +130,18 @@ }, labelStyles () { let style = {}; - const labelWidth = this.labelWidth || this.form.labelWidth; - if (labelWidth) { + const labelWidth = this.labelWidth === 0 || this.labelWidth ? this.labelWidth : this.form.labelWidth; + + if (labelWidth || labelWidth === 0) { style.width = `${labelWidth}px`; } return style; }, contentStyles () { let style = {}; - const labelWidth = this.labelWidth || this.form.labelWidth; - if (labelWidth) { + const labelWidth = this.labelWidth === 0 || this.labelWidth ? this.labelWidth : this.form.labelWidth; + + if (labelWidth || labelWidth === 0) { style.marginLeft = `${labelWidth}px`; } return style;