I have a simple button for adding items to a list:
<label for="numit">item number:</label> <input type="text" id="numit" :value="idxItemBuy"> <button id="buyitem" @click="buy($event.target.value)">Buy</button>
buy() { console.log("buy fonction") this.currentPlayer.buy(this.idxItemBuy) }
But the buy method is not actually called (And I don't know when I should use $event.target.value)
P粉8271215582024-04-03 15:16:36
You can read more about v-model => binding input with data (https://v2.vuejs.org/v2/guide/forms.html or https://v3.vuejs.org/guide/forms.html#text)
I wrote a valid code for you
sssccc
- {{ item }}