了解vue mustache基础操作
v-once
<div id="app">
<h3>{{message}}</h3>
<h3 v-once>{{message}}</h3>
</div>
<script src="../js/vue.js"></script>
<script>
const app = new Vue({
el: '#app',
data: {
message: 'Saber',
}
})
</script>
v-html
<div id="app">
<h4 v-html="url"></h4>
</div>
<script src="../js/vue.js"></script>
<script>
const app = new Vue({
el: '#app',
data: {
message: 'Saber',
url: '<a href="http://www.abc.com">这是一个链接</a>'
}
})
</script>
v-text
<div id="app">
<h3 v-text="message"></h3>
</div>
<script src="../js/vue.js"></script>
<script>
const app = new Vue({
el: '#app',
data: {
message: 'Saber',
}
})
</script>
v-pre
<div id="app">
<h3 v-pre>{{message}}</h3>
</div>
<script src="../js/vue.js"></script>
<script>
const app = new Vue({
el: '#app',
data: {
message: 'Saber',
}
})
</script>
v-cloak
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
[v-cloak]{display: none}
</style>
</head>
<body>
<div id="app">
<h3 v-cloak>{{message}}</h3>
</div>
<script src="../js/vue.js"></script>
<script>
setTimeout(function () {
const app = new Vue({
el: '#app',
data: {
message: 'Saber',
}
})
}, 2000)
</script>
</body>
</html>