فهرست منبع

Form: fix style when label-width is auto (#14955)

hetech 6 سال پیش
والد
کامیت
901ff0ed2b
2فایلهای تغییر یافته به همراه7 افزوده شده و 1 حذف شده
  1. 6 1
      packages/form/src/label-wrap.vue
  2. 1 0
      packages/theme-chalk/src/form.scss

+ 6 - 1
packages/form/src/label-wrap.vue

@@ -12,7 +12,12 @@ export default {
     const slots = this.$slots.default;
     if (!slots) return null;
     if (this.isAutoWidth) {
-      return (<div class="el-form-item__label-wrap">
+      const autoLabelWidth = this.elForm.autoLabelWidth;
+      const style = {};
+      if (autoLabelWidth && autoLabelWidth !== 'auto') {
+        style.width = autoLabelWidth;
+      }
+      return (<div class="el-form-item__label-wrap" style={style}>
         { slots }
       </div>);
     } else {

+ 1 - 0
packages/theme-chalk/src/form.scss

@@ -86,6 +86,7 @@
 
   @include e(label-wrap) {
     float: left;
+    text-align: right;
     .el-form-item__label {
       display: inline-block;
       float: none;