vue学习第一天:v-bind的使用(让属性绑定变量)

v-bind的使用

v-bind: 是vue中,提供用于绑定属性的指令 

例:

<input type="button" value="按钮" title="msg">

这里的msg会被认为是提示文字,在title前面加上v-bind: 以后msg被视为变量

<input type="button" value="按钮" v-bind:title="msg">
 
msg可以在data里进行赋值
 
msg: '这是提示文字'

v-bind 可以简写为:

<input type="button" value="按钮" :title="msg">
posted @ 2020-04-03 16:31  子枫i  阅读(2052)  评论(0编辑  收藏  举报