elementuiPlus 动态表单

<el-dialog :title="title" v-model="visibility" width="60%" :close-on-click-modal="false" draggable append-to-body>
    <el-form ref="formRef" :model="formData" :rules="formRules" :label-width="config.form.label.width" status-icon>
      <el-row>
        <template v-for="(item, index) in fieldsList" :key="index">
          <el-col :span="8">
            <el-form-item :label="item.fieldLabel" :prop="item.fieldName" :required="item.required">
              <template #error>
                <span class="el-form-item__error">{{ `${item.fieldLabel}不能为空` }}</span>
              </template>
              <el-input v-model="formData[item.fieldName]" v-if="item.fieldType === SceneSurveyCustomEnum.STRING"
                :placeholder="`${item.fieldLabel}`"></el-input>

              <el-input-number v-if="item.fieldType === SceneSurveyCustomEnum.NUMBER" v-model="formData[item.fieldName]"
                :precision="2" controls-position="right" :min="0"></el-input-number>

              <el-checkbox v-if="item.fieldType === SceneSurveyCustomEnum.BOOLEAN" v-model="formData[item.fieldName]" />

              <DatePicker v-if="item.fieldType === SceneSurveyCustomEnum.DATE" v-model="formData[item.fieldName]" />

            </el-form-item>
          </el-col>
        </template>
      </el-row>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="visibility = false">{{ config.button.text.close }}</el-button>
        <el-button type="primary" @click="addAndUpdateData">{{ config.button.text.save }}</el-button>
      </span>
    </template>
  </el-dialog>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值