比如:
1.加:disabled=“selectDisabled”
<a-form-item label="环境名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['envName']" placeholder="请输入环境名称" :disabled="selectDisabled"></a-input>
</a-form-item>
2.data()中selectDisabled: false
data() {
return {
。。。
//相应参数编辑时是否禁用
selectDisabled: false,
}
},
3.JSON.stringify(record) !== '{}'时重点
add() {
this.selectDisabled = false
this.edit({})
},
edit(record) {
this.form.resetFields();
this.model = Object.assign({}, record);
this.visible = true;
//编辑时
if (JSON.stringify(record) !== '{}') {
this.selectDisabled = true
}
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model, 'createrId', 'createBy', 'createTime', 'updateId', 'updateBy', 'updateTime', 'appId', 'remark', 'envName', 'envIdentifier'))
})
},