内置指令-cloak
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
[v-cloak] {
display: none;
}
</style>
</head>
<body>
<div id="app">
<div v-cloak>
<h1>{{message}}</h1>
<h1>{{message}}</h1>
<h1>{{message}}</h1>
</div>
</div>
<script src="./vue.js"></script>
<script>
new Vue({
el: '#app',
data: {
message: 'Hello World'
}
})
</script>
</body>
</html>
内置指令-once
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div id="app">
<template v-once>
<h1>{{message}}</h1>
<h1>{{message}}</h1>
</template>
<h1>{{message}}</h1>
<h1>{{message}}</h1>
</div>
## 标题
<script src="./vue.js"></script>
<script>
new Vue({
el: '#app',
data: {
message: 'Hello World'
}
})
</script>
</body>
</html>
内置指令-pre
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div id="app">
<div v-pre>
<h1>你好,世界!</h1>
<h1>你好,世界!</h1>
<h1>{{message}}</h1>
</div>
<h1>{{message}}</h1>
<h1>{{message}}</h1>
</div>
<script src="./vue.js"></script>
<script>
new Vue({
el: '#app',
data: {
message: 'Hello World'
}
})
</script>
</body>
</html>