There are too many front-end frameworks at present, and I have been exposed to angular and ember, and now I have started to rush vue
Here we use v-if, v-else, v-show, v-if or make the element not on the DOM. v-show just changes the display:block attribute, and it feels like v-if is good
Feeling and suitable,
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>v-if, v-else, v-show</title> <script src="../js/vue.js"></script> <!--copy from http://vuejs.org.cn/guide/--></head><body> <div id="app"> <p v-if="willShow"> show display</p> <p v-else> hide hidden hidden hidden hidden</p> <button @click="fn()">change</button> </div> <script> var vm=new Vue({ el:"#app", data:{ willShow:true }, methods:{ fn:function(){ if(this.willShow==true){ this.willShow=false; }else{ this.willShow=true } } } }); </script></body></html>The above article vueJS's simple click display and hidden effect [Implementation Code] is all the content I have shared with you. I hope you can give you a reference and I hope you can support Wulin.com more.