除了click单击事件,还有mouseover,mouseover等鼠标事件。
dbclick双击事件。
v-on:click/mouseover/mouseover/mousedown/dbclick/...
v-show指令
v-show="true/false" //控制元素显示/隐藏
示例代码:
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8"> <script src="https://unpkg.com/vue/dist/vue.js"></script> <script type="text/javascript"> window.onload = function(){ var vm = new Vue({ el:'#box', data:{ isShow:false, }, methods:{ toggle:function(){ this.isShow = !this.isShow; } } }); } </script> </head> <body> <div> <input type="button" value="toggle" v-on:click="toggle()"> <br /> <div v-show="isShow"></div> </div> </body> </html>