当前位置:   article > 正文

a-form的表单如何给字段赋值_a-from 设置字段值

a-from 设置字段值
  1. <a-form :model="addEform" :form="addEform">
  2. <a-form-item label="名称" style="display:flex">
  3. <a-input :disabled="disabled" style="width:80%" v-decorator="['equipmentName', { rules: [{ required: true, message: '不能为空' }] }]" />
  4. </a-form-item>
  5. <a-form-item label="编号">
  6. <a-textarea placeholder="请选择" v-decorator="['equipmentNos', { rules: [{ required: true, message: '不能为空' }] }]" :auto-size="{ minRows: 3, maxRows: 5 }" /> </a-form-item>
  7. <a-form-item style="display: flex;justify-content: space-around;">
  8. <a-button type="primary" @click="addEConfim" style="margin-right:10px">
  9. 确认
  10. </a-button>
  11. <a-button type="primary" @click="addECancel">
  12. 取消
  13. </a-button>
  14. </a-form-item>
  15. </a-form>
  16. //data中初始化
  17. data() {
  18. return {
  19. addEform: this.$form.createForm(this, {
  20. name: 'coordinated'
  21. }),
  22. }
  23. //methods中给字段赋值
  24. this.$nextTick(() => {
  25. this.addEform.setFieldsValue({
  26. equipmentNos: '44444444444'
  27. });
  28. })
  29. //添加确认
  30. addEConfim() {
  31. this.addEform.validateFields((err, values) => {
  32. if (!err) {
  33. } else {
  34. }
  35. })
  36. }
  37. });
  38. },

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

闽ICP备14008679号