(Vuejs) Undefined property or method on instance referenced during rendering
P粉216203545
P粉216203545 2024-04-02 16:43:16
0
1
372

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粉216203545
P粉216203545

reply all(1)
P粉827121558

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!