刚学 vue,我做个练习: <div id="app-5"> <button v-on:click="func1">点击按钮</button> <b>{{seenmsg}}</b> <p v-if="seen">11111111111111111</p> </div> <script type="text/javascript"> var app5 = new Vue({ el: '#app-5', data: { seen: true, seenmsg: '' }, methods: { func1: function () { this.seen=!this.seen; if(this.seen==true){this.seenmsg='段落已被显示';} if(this.seen==false){this.seenmsg='段落已被隐藏';} } } }) </script>
刚学 vue,我做个练习: