vue事件对象-冒泡-阻止默认行为

事件对象:

methods:{ show:function(ev){ alert(ev.clientX); alert(ev.clientY); } }

<input type="button" name="" value="按钮" @click="show($event)">

冒泡:

<input type="button" name="" value="按钮" @click.stop="show()">

默认行为:

<div class="show2"> <input type="button" name="" value="按钮" @contextmenu.prevent="show()"> </div>

methods: {
                    show: function () {
                        alert(111)
                    }
  }

猜你喜欢

转载自blog.csdn.net/aliven1/article/details/84340359