Using vue.js/Vanilla js, I want to put the data being pulled via the checkbox into an "inquiryObj" object and send it to a parent component in an array of "inquiry" objects by emit, but when I uncheck the checkbox it creates an object equals instead of removing from the array of objects.
how am i doing:
async inquiryPage(estate)
{
if (this.inquiry.includes(estate.id))
{
this.inquiry = this.inquiry.filter((item) => item !== estate.id);
this.inquiry = this.inquiry.filter((item) => item !== 'ikkodate');
this.inquiry = this.inquiry.filter((item) => item !== estate.estateName);
this.inquiry = this.inquiry.filter((item) => item !== estate.estatePrice);
}
else
{
this.inquiryObj.push(estate.id);
this.inquiryObj.push('ikkodate');
this.inquiryObj.push(estate.estateName);
this.inquiryObj.push(estate.estatePrice);
let obj = Object.assign({}, this.inquiryObj);
this.inquiry.push(obj)
}
await this.$emit("inquiry", this.inquiry)
}
the project is running on vue 2.6.11