1
I’m trying to change the value of this object/property but returns the error of underfined even when I give console.log, I wanted to understand why I can’t get to it. - HTML
<li v-for="item in items">
{{item.name}} - {{item.Qtd}}
<input type="button" value="+" @click="AdicionarQtd()">
<input type="button" value="Remover Item" @click="removerItem">
<span v-if="!(item.Qtd >0)">Fora de estoque</span>
</li>
-Method
AdicionarQtd: function(item){
this.item.Qtd+=1;
}
Json
items: [{
name:'caneta',
Qtd:5,
}],
In the method you did not pass the
item
and the function called itself variable of its scope. It will not really work– novic