<template>
<div>
{{dialogForm}} <div @click="updateDialogForm">99909009</div>
<!-- Your component template here -->
</div>
</template>
<script>
export default {
data() {
return {
dialogForm: {
returnNode: "",
returnRatio: "",
returnMoney: "",
contractWaitReturnMoney: "",
returnWay: "",
returnCondition: "",
remark: "",
},
};
},
methods: {
updateDialogForm() {
let newData={
returnNode: "12",
returnRatio: "23",
returnMoney: "32",
contractWaitReturnMoney: "32",
returnWay: "32",
returnCondition: "32",
remark: "32",
}
// 遍历新数据对象,并使用 this.$set 更新 dialogForm
Object.keys(newData).forEach((key) => {
this.$set(this.dialogForm, key, newData[key]);
});
},
},
// Call this method whenever you want to update dialogForm with new data
// For example, this.updateDialogForm({ returnNode: "new value", returnRatio: "new ratio", ... })
};
</script>