vue实现数据的显示和隐藏
html>html lang="en">head>meta charset="UTF-8">title>css动画title>head>script src="vue.min.js">script>body>div id="app">button @click="toggle">显示和隐藏数据button>br>span v-show="issh
·
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>css动画</title> </head> <script src="vue.min.js"></script> <body> <div id="app"> <button @click="toggle">显示和隐藏数据</button><br> <span v-show="isshow">hello</span> </div> </body> <script> new Vue({ el:'#app', data:{ isshow:false }, methods: { toggle:function () { this.isshow=!this.isshow;//对它进行取反 } } }); </script> </html>
更多推荐
已为社区贡献5条内容
所有评论(0)