1.v-html,v-text,v-once,v-pre
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div id='app'>
<input type="text" v-model='msg'>
<p v-html='msg'>{{msg}}</p>
<h3 v-text='msg'>{{msg}}</h3>
<a href="" v-once>{{msg}}</a>
<h1 v-pre>{{msg}}</h1>
</div>
<script src='js/vue.js'></script>
<script>
new Vue({
el:'#app',
data:{
msg:'hello'
}
})
</script>
</body>
</html>
2.v-cloak
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
[v-cloak]{
display:none;
}
</style>
</head>
<body>
<div id='app'>
<h1 v-cloak>{{msg}}</h1>
</div>
<script src='js/vue.js'></script>
<script>
new Vue({
el:'#app',
data:{
msg:'hello vue'
},
beforeMount:function(){
alert('beforeMount')
}
})
</script>
</body>
</html>
网友评论