v-model
為頁面輸入框進行數據綁定
- input
- select
- textarea
- components 組件
input
<div id="myApp">
<p>你最喜歡的游戲是:{{mygame}}</p>
<input v-model="mygame">
</div>
<script>
var myApp = new Vue({
/*綁定標簽的id*/
el: '#myApp',
/*標簽上綁定的數據*/
data: {
/*用戶輸入的內容*/
mygame: '最終幻想'
},
});
</script>