Commit e9f3d00f0380bd91ab3a4d74005586da977037ba

Authored by 梁灏
1 parent 19a11e3b

fixed Form label bug, close 4289

Showing 1 changed file with 6 additions and 4 deletions   Show diff stats
src/components/form/form-item.vue
... ... @@ -130,16 +130,18 @@
130 130 },
131 131 labelStyles () {
132 132 let style = {};
133   - const labelWidth = this.labelWidth || this.form.labelWidth;
134   - if (labelWidth) {
  133 + const labelWidth = this.labelWidth === 0 || this.labelWidth ? this.labelWidth : this.form.labelWidth;
  134 +
  135 + if (labelWidth || labelWidth === 0) {
135 136 style.width = `${labelWidth}px`;
136 137 }
137 138 return style;
138 139 },
139 140 contentStyles () {
140 141 let style = {};
141   - const labelWidth = this.labelWidth || this.form.labelWidth;
142   - if (labelWidth) {
  142 + const labelWidth = this.labelWidth === 0 || this.labelWidth ? this.labelWidth : this.form.labelWidth;
  143 +
  144 + if (labelWidth || labelWidth === 0) {
143 145 style.marginLeft = `${labelWidth}px`;
144 146 }
145 147 return style;
... ...