当前位置:   article > 正文

elementUI 自定义表单数组校验_el-form校验rules 数组

el-form校验rules 数组
  1. <el-dialog
  2. :title="title"
  3. :visible.sync="visable"
  4. width="40%"
  5. :before-close="cancel">
  6. <el-form label-width="80px" :model="formData" :rules="formDataRules" ref="formData" >
  7. <el-form-item label="Id" prop="id" v-if="formData.id">
  8. {{formData.id}}
  9. </el-form-item>
  10. // begin ---------------------
  11. <div v-for="(item, index) in formData.test" :key="index">
  12. <el-form-item label="test1" :prop="`test[${index}].test1`" :rules="{ required: true, message: '请输入test1', trigger: 'blur' }">
  13. <el-input type="text" v-model="item.test1"></el-input>
  14. </el-form-item>
  15. <el-form-item label="test2" :prop="`test[${index}].test2`" :rules="{ required: true, message: '请输入test2', trigger: 'blur' }">
  16. <el-input type="text" v-model="item.test2"></el-input>
  17. </el-form-item>
  18. </div>
  19.          // end ---------------------
  20. </el-form>
  21. <div slot="footer" class="dialog-footer">
  22. <el-button @click="cancel">取 消</el-button>
  23. <el-button type="primary" @click="save('formData')">确 定</el-button>
  24. </div>
  25. </el-dialog>

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/112941
推荐阅读
相关标签
  

闽ICP备14008679号