In general, we recommend only adding (click)
events to elements that
are normally clickable. This includes <button>
and <a>
elements.
This improves accessibility as a screen reader will be able to tell that the element is clickable.
However, you may need to add a
(click)
event
to an element that is not normally clickable. When you do this you may experience a 300ms
delay
from the time you click the element to the event firing. To remove this delay, you can add the tappable
attribute
to your element.<div
tappable (click)="doClick()">I
am clickable!</div>
一般来说,我们建议您只向通常可点击的元素添加(点击)事件。 这包括<button>和<a>元素。 这提高了可访问性,因为屏幕阅读器将能够告诉该元素是可点击的。
但是,您可能需要向通常不可点击的元素添加(点击)事件。 执行此操作时,您可能会遇到从点击元素到事件触发的300毫秒延迟。 要删除此延迟,可以将tappable属性添加到元素。