Vue之事件相关

阻止事件冒泡:使用stop

<div @click="func2">
            <div @click.stop="func($event)">
                <input type="button" value="按钮1">
                <input type="button" value="按钮2">
                <input type="button" value="按钮3">
    
            </div>
</div>
 
阻止链接跳转:使用prevent
 
<a href="http://www.baidu.com" @click.prevent="func3">百度</a>
 
使用enter触发事件:
<input type="text" @keyup.enter="func4">
 
 
posted @ 2020-12-06 23:14  #Friday  阅读(55)  评论(0)    收藏  举报