123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <script src="./js/vue.js"></script>
- <style>
- [v-cloak]{
- display: none;
- }
- </style>
- </head>
- <body>
- <div id="app">
-
- <!-- <div v-pre>
- {{num}}
- </div> -->
- <!-- v-once 仅加载一次 -->
- <!-- <h1 v-once>{{num}}</h1> -->
- <!-- v-cloak 优化首次加载的页面效果 -->
- <h1 v-cloak>{{num}}</h1>
- <button @click="changeNum">add</button>
- </div>
- <script>
- let app = new Vue({
- el:"#app",
- data:{
- num:10,
- str:"hello"
- },
- methods: {
- changeNum:function(){
- this.num = 100
- }
- },
- })
- </script>
- </body>
- </html>
|