This article introduces you to the Vue form demo v-model two-way binding problem through example code. The code is simple and easy to understand, which is very good and has certain reference value. Friends in need can refer to the specific code
As shown below:
<p id="app"> <textarea v-model = "message" placeholer = '请在此输入文字'></textarea> <span>{{message}}</span> </br> <input type="text" v-model="data.name"/> <span>姓名:{{data.name}}</span> </br> <input type="radio" id="boy" value="男" v-model="data.gender"/> <label for="boy">男</label> <input type="radio" id="girl" value="女" v-model="data.gender"/> <lable for="girl">女</lable> <span>{{data.gender}}</span> <br/> <input type="checkbox" id="item1" value="阅读" v-model="data.interest"/> <lable for="item1">阅读</lable> <input type="checkbox" id="item2" value="打球" v-model="data.interest"/> <lable for="item2">打球</lable> <input type="checkbox" id="item3" value="体操" v-model="data.interest"/> <lable for="checkbox">体操</lable> <br/> <span>{{data.interest}}</span> <select v-model="data.identity"> <option value="java" selected>java</option> <option value="web">web</option> <option value="hr">hr</option> </select> <span>身份:{{data.identity}}</span> </p> <script src="js/vue.js"></script> <script> new Vue({ el: '#app', data: { message: '6', data: { name: '', gender: '', interest: [], identity: '' }, } }) </script>
The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!
Related recommendations:
About the method of Vue2 SSR caching Api data
About VUE-region selector (V- Introduction to the use of Distpicker) component
The above is the detailed content of Regarding the problem of two-way binding of Vue form demo v-model. For more information, please follow other related articles on the PHP Chinese website!