vue 笔记
作者:互联网
1、插值表达式
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Title</title> 6 <script src="vue.min.js"></script> 7 </head> 8 <body> 9 <div id="app"> 10 {{name}} 11 {{name2}} 12 </div> 13 14 </body> 15 <script type="text/javascript"> 16 new Vue({ 17 el:"#app", 18 data:{ 19 name:"rer", 20 name2:"xxx" 21 } 22 }) 23 </script> 24 </html>View Code
2、v-text、v-html、v-model、v-bind
v-model:双向绑定,绑定模型和视图
v-bind:绑定属性,v-bind:href=""
1 <body> 2 <div id="app"> 3 <h6 v-text="name"></h6> 4 <div v-html="name2"></div> 5 <input type="text" v-model="name"/>{{name}} 6 <a v-bind:href="ahref">百度一下</a> 7 </div> 8 9 </body> 10 <script type="text/javascript"> 11 new Vue({ 12 el:"#app", 13 data:{ 14 name:"zd", 15 name2:"<input type=\"text\">", 16 ahref:"http://baidu.com" 17 } 18 }) 19 </script> 20 </html>View Code
标签:el,vue,name,bind,绑定,笔记,Code,name2 来源: https://www.cnblogs.com/zhang-dan/p/15706689.html