In my VueJS code, I have data structured like this:
params: {
comment: Object,
state: "",
deleteAppointment: false,
appointmentId: null,
}
I am populating this data using two functions. The first function simply assigns these lines:
this.params.state = "BLACKLIST";
this.params.deleteAppointment = true;
this.params.appointmentId = this.appointmentId;
However, in the second function when I try to assign the following:
const comment = {};
fd.forEach(function(value, key){
comment[key] = value;
});
const data = {};
Object.keys(this.lead).map((key) => {
if (this.lead[key] != this.orginal[key]) {
data[key] = this.lead[key];
}
});
this.params = data; // There might be an issue here as it overwrites existing properties of params
this.params.comment = comment;
Unfortunately, when assigning data to params in the second function, the previous properties seem to disappear! I suspect that I may need to make a copy of the object or something similar. I am currently unsure of what steps to take.