由于某个项目用的v-decorator,所以今天记录一下v-decorato
<a-form-item label="推广人类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select
@change="getType"
placeholder="请选择推广人类型"
v-decorator="['promotionType', validatorRules.promotionType]"
>
<a-select-option :value="1">11</a-select-option>
<a-select-option :value="2">222</a-select-option>
<a-select-option :value="3">33</a-select-option>
</a-select>
</a-form-item>
validatorRules: {
name: {
rules: [
{
required: true,
message: "请输入姓名!",
},
],
},
}
form: this.$form.createForm(this),
getType() {
this.$nextTick(() => {
this.promotionType = this.form.getFieldValue("promotionType");
});
},
this.$nextTick(() => {
this.form.setFieldsValue({promotionType: '设置值'});
});
this.form.resetFields();
this.form.validateFields((err, values) => {
if (!err) {