简体   繁体   English

长时间按一下离子按钮

[英]Ionic button on-tap with long duration

According to the docs 根据文件

on-tap 上抽头

Quick touch at a location. 快速触摸某个位置。 If the duration of the touch goes longer than 250ms it is no longer a tap gesture. 如果触摸持续时间超过250毫秒,则不再是轻击手势。

How to trigger event in case user presses the button, holds for more than 250ms, and releases it (while the finger is still in the button area)? 如果用户按下按钮并保持250ms以上并释放(手指仍然在按钮区域中),该如何触发事件? I tried on some native apps, the event is triggered but not in ionic app (on-tap, ng-click). 我在某些本机应用程序上尝试过,该事件已触发,但在离子应用程序中却未触发(点击,ng-click)。

Hence the ionic button does not feel native. 因此,离子按钮不会感觉很自然。 Is there a normal way to work around this issue? 有正常的方法来解决此问题吗?

You need to disable swipe back on ion-nav-view : 您需要在ion-nav-view上禁用向后滑动:

.config(function($ionicConfigProvider){
    $ionicConfigProvider.views.swipeBackEnabled(false);
})

Buttons in ionic have an on-hold event: ionic中的按钮具有保留事件:

<button on-hold="onHold()" class="button">Test</button>

here you can read the documentation 在这里您可以阅读文档

对于Ionic 2/3,您可以使用“ press ”事件。

<button ion-button type="button" (press)="myAction()">My Button</button>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM