Angular 2(单击)和(dblclick)对同一元素不起作用? [英] Angular 2 (click) and (dblclick) on the same element not working good?
本文介绍了Angular 2(单击)和(dblclick)对同一元素不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我这样做时:
<div (click)="func1()" (dblclick)="func2()">Some text</h1>
我实际上得到func1()即使在dblclick上也会被触发两次。
I actually get "func1()" to fire even on dblclick twice.
如何让它在相同的元素上工作并且工作正常?
How can I make it work on the same element and work good?
推荐答案
不要似乎是一个角度问题。请参阅 https:// css-tricks .com / snippets / javascript / bind-different-events-to-click-and-double-click /
Doesn't seem to be an Angular issue. See https://css-tricks.com/snippets/javascript/bind-different-events-to-click-and-double-click/
解决方法是不处理点击事件发生后不久发生了dblclick。
The workaround is to not process the click event when a dblclick happens shortly afterwards.
这篇关于Angular 2(单击)和(dblclick)对同一元素不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文