1 <!DOCTYPE html> 2 <html lang="en"> 3 4 <head> 5 <meta charset="UTF-8"> 6 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 7 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 8 <title>表单绑定</title> 9 </head> 10 11 <body> 12 <div id="div"> 13 <form autocomplete="off"> 14 姓名:<input type="text" name="username" v-model="username" /> 15 <br> 16 年龄:<input type="number" name="age" v-model="age" /> 17 </form> 18 </div> 19 </body> 20 <script src="../js/vue.js"></script> 21 <script> 22 let v = new Vue({ 23 el: "#div", 24 data: { 25 username: "zhangsan", 26 age: 23 27 } 28 }); 29 </script> 30 31 </html>