1.v-cloak
使用 v-cloak 能够解决 插值表达式闪烁的问题
<div id="app" v-cloak> {{context}} </div>
[v-cloak] {
display: none;
}
2.v-text
<h4 v-text="msg">==================</h4>
<!-- 默认 v-text 是没有闪烁问题的 -->
v-text会覆盖元素中原本的内容,但是 插值表达式 只会替换自己的这个占位符,不会把 整个元素的内容清空
3.v-html
会解析标签,只展示内容
<h3 v-html="msg2"></h3>
var vm = new Vue({
el: '#app',
data: {
msg: '123',
msg2: '<h1>哈哈,我是一个大大的H1, 我大,我骄傲</h1>',
mytitle: '这是一个自己定义的title'
},
methods: { // 这个 methods属性中定义了当前Vue实例所有可用的方法
show: function () {
alert('Hello')
}
}
})
4.