1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > vue 指令 v-on 事件修饰符-鼠标事件-什么是事件冒泡

vue 指令 v-on 事件修饰符-鼠标事件-什么是事件冒泡

时间:2024-04-19 14:23:11

相关推荐

vue 指令 v-on 事件修饰符-鼠标事件-什么是事件冒泡

什么是事件冒泡

<body><div id="app"><div>{{num}}</div><div v-on:click='handle0'><button v-on:click.stop='handle1'>点击1</button></div><div><a href="" v-on:click.prevent='handle2'>百度</a></div></div><script type="text/javascript" src="js/vue.js"></script><script type="text/javascript">/*事件绑定-事件修饰符*/var vm = new Vue({el: '#app',data: {num: 0},methods: {handle0: function(){this.num++;},handle1: function(event){// 阻止冒泡// event.stopPropagation();},handle2: function(event){// 阻止默认行为// event.preventDefault();}}});</script></body>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。