本文介绍了ionic2 tap vs click的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从angular2和ionic2开始;

I am starting with angular2 and ionic2;

在ionic2中,我有一个按钮,可以调用我的组件的方法。像这样:

In ionic2, I have a button that will call a method of my component. Like this:

<button secondary clear large>
</button>

我应该使用(点击) - angular2 OR (点按) - ionic2?

Should I use (click) - angular2 OR (tap) - ionic2?

喜欢这样:

(点击)

<button secondary clear large (click)="pause()">
</button>

(点按)

<button secondary clear large (tap)="pause()">
</button>

有什么区别?你可以在
中看到(点击)

There are some difference? You can see about (tap) inhttp://ionicframework.com/docs/v2/components/#gestures

Thx。

推荐答案

如果制作移动应用,(点击)可能会更好。这是因为当使用(单击)时,即使在意外点击时,操作也会始终执行。如果用户持有较长时间,(点击)将不会执行。如果你想要一个需要点击更长时间的按钮,你可以使用(按)

If making mobile apps, (tap) might be better. This is because when using (click) the action always executes, even when tapping accidently. The (tap) won't execute if the user holds it for a longer period. And if you want to have a button that needs to be clicked for a longer period of time you can use the (press).

请注意,在某些离子版本中,(单击)事件将无法在iOS上执行。因此,建议使用(点击)

Note that in some ionic versions the (click) event won't execute on iOS. Therefore using (tap) would be the recommended solution.

这篇关于ionic2 tap vs click的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-02 21:53