<body> <div id="root"> <form action="" @submit.prevent="demo"> <label for="TW"> Name:</label> <input type="text" id="TW" v-model.trim="userInfo.account"><br><br> Password: <input type="password" id="pa" v-model="userInfo.password"><br><br> Age: <input type="number" v-model.number="userInfo.age"> <br><br> Gender: <input type="radio" name="sex" value="male" v-model="userInfo.sex">Male<input type="radio" name="sex" v-model="userInfo.sex" value="female">Female<br><br> Hobbies: Campus: <select v-model="userInfo.city"> <option value="school">Please select a campus</option> <option value="beijing">Beijing</option> <option value="shanghai">Shanghai</option> <option value="shenzhen">Shenzhen</option> </select> <br><br> <input type="checkbox" v-model="userInfo.hobby" value="study"> Study<input type="checkbox" v-model="userInfo.hobby" value="sing"> Sing<input type="checkbox" v-model="userInfo.hobby" value="dance"> Dance<input type="checkbox" v-model="userInfo.hobby" value="game"> King<br><br> Other information: <textarea name="" v-model.lazy="userInfo.other"></textarea><br><br> <input type="checkbox" v-model="userInfo.agree"> Read and accept the <a href="#">User Agreement</a><button>Submit</button> </form> </div> <script> Vue.config.productionTip = false; new Vue({ el: '#root', data: { userInfo: { account: '', password: '', age: '', sex: 'female', city: 'beijing', hobby: [], other: '', agree: '', } }, methods: { demo() { console.log(JSON.stringify(this.userInfo)); } } }) </script> </body> SummarizeThis article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM! You may also be interested in:
|
<<: 18 Web Usability Principles You Need to Know
>>: How to deploy k8s in docker
Abstract: This article will demonstrate how to se...
You can write a function: Mainly use regular expr...
Table of contents String length: length charAt() ...
Project Background Recently, there is a project w...
Table of contents Overview 1. Develop the require...
Introduction to Selenium Grid Although some new f...
Table of contents Why use Docker? Docker installa...
Linux finds a specific program where is The where...
Table of contents What is Flattening recursion to...
I don't know when it started, but every time ...
Docker is a very popular container technology. Th...
1. Create a table using HTML tags: Copy code The ...
Table of contents 1. Scope 2. Scope Chain 3. Lexi...
Table of contents 1. Brief description 2. Steps t...
Preface Nodejs is a server-side language. During ...