<a-form :model="addEform" :form="addEform">
<a-form-item label="名称" style="display:flex">
<a-input :disabled="disabled" style="width:80%" v-decorator="['equipmentName', { rules: [{ required: true, message: '不能为空' }] }]" />
</a-form-item>
<a-form-item label="编号">
<a-textarea placeholder="请选择" v-decorator="['equipmentNos', { rules: [{ required: true, message: '不能为空' }] }]" :auto-size="{ minRows: 3, maxRows: 5 }" /> </a-form-item>
<a-form-item style="display: flex;justify-content: space-around;">
<a-button type="primary" @click="addEConfim" style="margin-right:10px">
确认
</a-button>
<a-button type="primary" @click="addECancel">
取消
</a-button>
</a-form-item>
</a-form>
//data中初始化
data() {
return {
addEform: this.$form.createForm(this, {
name: 'coordinated'
}),
}
//methods中给字段赋值
this.$nextTick(() => {
this.addEform.setFieldsValue({
equipmentNos: '44444444444'
});
})
//添加确认
addEConfim() {
this.addEform.validateFields((err, values) => {
if (!err) {
} else {
}
})
}
});
},
a-form的表单如何给字段赋值
于 2022-10-20 10:17:17 首次发布