Przeglądaj źródła

修改表单组件

YY 2 lat temu
rodzic
commit
9180e54908
1 zmienionych plików z 10 dodań i 3 usunięć
  1. 10 3
      src/components/frame/c-form.vue

+ 10 - 3
src/components/frame/c-form.vue

@@ -1,9 +1,10 @@
 <template>
   <div id="c-form">
     <el-row type="flex" justify="space-around">
-      <el-col :span="span">
+      <el-col>
         <el-form ref="formRef" :model="form" :rules="rules" :label-width="labelWidth" class="form" @submit.prevent>
-          <template v-for="(item, index) in fields">
+          <!-- <template > -->
+          <el-col :span="span" v-for="(item, index) in fields" :key="index">
             <el-form-item v-if="display(item)" :key="'form-field-' + index" :label="getField('label', item)" :prop="item.model" :required="item.required">
               <template v-if="!item.custom">
                 <template v-if="item.type === 'textarea'">
@@ -123,7 +124,8 @@
                 <slot :name="item.model" v-bind="{ item }"></slot>
               </template>
             </el-form-item>
-          </template>
+          </el-col>
+          <!-- </template> -->
           <el-col :span="24" label="" class="btn" v-if="isSave">
             <slot name="submit">
               <el-button type="primary" @click="save(formRef)">{{ submitText }}</el-button>
@@ -217,4 +219,9 @@ const dataChange = (model: string) => {
 .btn {
   text-align: center;
 }
+.form {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+}
 </style>