I have an array as follows.
[ "icono-5-4", "icono-7-6", "icono-8-7", "icono-9-8", "icono-1-0", "icono-2-1" ]
I want to reactively remove an element: I will know the name of the element until the user clicks a button. Example, if the client clicks a button and the button has the value icon-9-8
I would have to delete that element from my array
[ "icono-5-4", "icono-7-6", "icono-8-7", "icono-1-0", "icono-2-1" ]
and so on for this I use:
_.pull(this.array, 'icono-9-8');
but this is not reactive or does not do it as fast as I want.
this.array.slice(id, 1)
I don't really know what you're doing, I don't understand the
_.pull(this.array, 'icono-9-8');
.You can use
splice()
to delete an item better thanslice()
since vue watches the changes withsplice()
and modifies the array instead of creating a new one.Hello, how about you try with array filter: