1
I have a certain array:
acoes_selecionadas: ['nome1', 'nome2'];
I’m using that function, but splice
works based on element ID, need to find a way to remove by value.
seta_vender: function() {
this.vender = !this.vender;
if (this.vender) {
this.acoes_selecionadas.push('Vender');
} else {
this.acoes_selecionadas.splice('Vender');
}
}
I believe in case the condition would be reversed,
vender !== val
, because he wants to remove the element. Also, there is the question of whether there are duplicate elements. Thefilter
will remove all, but maybe this is not what is desired - it would be good to question the AP on this.– Woss