vue v-model 数据双向绑定(笔记)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <script src="../JS/vue.js"></script> <body> <div id="app"> <label v-for="item in orhobby"> <input type="checkbox" :value="item" id="item" v-model="hobbies">{{item}} </label> <br> 以下为选中的数据 {{hobbies}} <br> <input type="text" v-model.lazy="username"> 以下为 type="text"的数据 {{username}} </div> <script> const app =new Vue({ el:"#app", //挂载那个元素 data:{ messagqe:"胡鸡鸡", name:"hujiji", orhobby:["揽投","足球","乒乓球","羽毛球"], hobbies:[], username:''}, methods:{ } }) </script> </body> </html>