[Vuejs]-Cant handle model in Vue.js

2πŸ‘

This is the fixed script for you. As a general advice, in future try to read your console and thus figure out the origin of mistake. The problems were that you reference vue not the way you should, and secondly you reference the app element in a wrong way

let myApp = new Vue({
  
  el:'#myApp',
  data:{
     myGame:'θΆ…η΄šι¦¬εŠ›ζ­'
  },
  
  methods:{
    
    btnClick: function(pname){
      this.myGame = pname;
    },
  },
  
});
  
  <div id="myApp" >
    <p> ζ‚¨ζœ€ε–œζ­‘ηš„ιŠζˆ²ζ˜―οΌš{{myGame}}</p>
    
    <button v-on:click="btnClick('ζˆ‘ηš„δΈ–η•Œ')">ζˆ‘ηš„δΈ–η•Œ</button>
    <button v-on:click="btnClick('ζˆ‘ηš„δΈ–η•Œ33')">ζˆ‘ηš„δΈ–η•Œ33</button>
    <button v-on:click="btnClick('ζˆ‘ηš„δΈ–η•Œ44')">ζˆ‘ηš„δΈ–η•Œ44</button>
    <button @click="btnClick('ζˆ‘ηš„δΈ–11η•Œ')">ζˆ‘ηš„δΈ–11η•Œ</button>
    
  </div>

<script src="https://unpkg.com/vue@2.5.16/dist/vue.js"></script>
πŸ‘€seethrough

Leave a comment