ionic2 点击与点击 [英] ionic2 tap vs click

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

问题描述

我从 angular2 和 ionic2 开始;

在 ionic2 中,我有一个按钮,它将调用我的组件的方法.像这样:

<按钮二次清大></按钮>

我应该使用 (click) - angular2 OR (tap) - ionic2 吗?

像这样:

(点击)

<按钮二级清大(click)="pause()"></按钮>

(点击)

<按钮二级清大(tap)="pause()"></按钮>

有什么不同吗?你可以在 (tap) 中看到http://ionicframework.com/docs/v2/components/#gesturesp>

谢谢.

解决方案

如果做移动应用,(tap) 可能会更好.这是因为当使用 (click) 时,动作总是会执行,即使是在不小心点击的时候.(tap) 如果用户持有较长时间,则不会执行.如果你想要一个需要长时间点击的按钮,你可以使用(press).

请注意,在某些 ionic 版本中,(click) 事件不会在 iOS 上执行.因此使用 (tap) 将是推荐的解决方案.

I am starting with angular2 and ionic2;

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

<button secondary clear large>
</button>

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

Like this:

(click)

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

(tap)

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

There are some difference? You can see about (tap) in http://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).

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆