vue起步之三v-bind数据绑定

设置一个数据为website的值为http://www.baidu.com

在html中我们进行绑定通过v-bind:属性名=“键名”

如:<a v-bind:href="website">web开发</a> 注意:这里的website没有两个大括号

我们在为input绑定

<input v-bind:value="name" type="text">

运行结果:

绑定标签:这里需要添加websiteTag:"<a href='website'>web开发2</a>",

我们必须通过html标签使用v-html="键名"进行调用:

如:<p v-html="websiteTag"></p>

运行结果:

猜你喜欢

转载自blog.csdn.net/qq_35723619/article/details/83692449