The first program vue
<body> <div class="app"> {{message}}--{{message+','+message}} <div :id='message' v-if="showMessage">{{title}}</div> <div v-else style="text-decoration: line-through;">{{title}}--{{title}}</div> <div :id='message' v-show="showMessage">{{title}}</div> </div> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <script> var vm = new Vue({ on: ' .app ' , data:{ message:'hello world', showMessage:false, title: " Delete " } }) </script> </body>
- El may be inside the id attribute, the class attribute may be, such as id = "app", then el: '# app', if class = "app", then el: '. App'
- V-if instruction and v-show: v-if determination is false, the page is not added to the dom node, and only the v-show display of the set or other labels div: none