模板语法
插值
绑定的数据对象上 msg 属性发生了改变,插值处的内容都会更新 Message: {{ msg }}
一次性地插值,当数据改变时,插值处的内容不会更新 这个将不会改变: {{ msg }}
原始 HTML
v-html会保留原始html的属性
rawHtml = This should be red.
Using mustaches: {{ rawHtml }}
输出: Using mustaches:
This should be red.
Using v-html directive:
输出 Using v-html directive: This should be red(文字颜色为红色).
attributes
v-bind实现 Mustache 语法作用在 HTML attributes上
对于布尔特性 (它们只要存在就意味着值为 true)
如果 isButtonDisabled 的值是 null、undefined 或 false,则 disabled 特性甚至不会被渲染进入