When you use the splice
method, it alters the content of customBenefitsObj
, but not the array itself. For example:
this.customBenefitsObj = []
In this case, the set
function of customBenefitsObj will be triggered, along with the emit
function.
It is generally advised against mutating props directly. Instead, you should emit a modified copy of the array and replace it in a parent component. Alternatively, you can emit a remove operation along with the element to be removed (the actual removal process should ideally take place in the parent component).