Ionic 2系列touchend活动 [英] Ionic 2 range touchend event

查看:193
本文介绍了Ionic 2系列touchend活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在输入结束时获取Ionic 2的范围滑块的值。



doumentation 唯一可用的事件是ionChange,它在输入过程中会多次触发,我只需要最后一个值来执行操作。



<我尝试手动添加touchend事件,但忽略了该事件。



这里还有 Plunker 有问题。

 < ion-range(ionChange)=showVal($ event)(touchend) =presentValue(event)min =0max =100[(ngModel)] =currentTimecolor =danger> 
< ion-icon small range-left name =sunny>< / ion-icon>
< ion-icon range-right name =sunny>< / ion-icon>
< / ion-range>

有人知道在Ionic 2的范围滑块上收听touchend事件的方法吗?

解决方案

还有 ionBlur 您可以使用的范围输入上的ionFocus 事件。



当您启动 ionFocus 时会触发你已经释放了范围项目时会触发
范围内的 ionBlur

 < ion-range(ionBlur)=rangeBlurred($ event)(ionFocus)=rangeFocused($ event)> 


I´m trying to get the value of a range slider with Ionic 2 at the end of an input.

In the doumentation the only availible event is the ionChange, which triggers several times during an input, and I only need the last value to perform an action.

I tried to add the touchend event manually but the event is ignored.

Here´s also a Plunker with the Problem.

<ion-range (ionChange)="showVal($event)" (touchend)="presentValue(event)" min="0" max="100" [(ngModel)]="currentTime" color="danger">
          <ion-icon small range-left name="sunny"></ion-icon>
          <ion-icon range-right name="sunny"></ion-icon>
     </ion-range>

Does anybody know a way to listen to an touchend event on the range slider in Ionic 2?

解决方案

There is also the ionBlur and ionFocus event on the range input you could use.

The ionFocus fires when you are sliding through the range and the ionBlur is fired when you have released the range item

<ion-range (ionBlur)="rangeBlurred($event)" (ionFocus)="rangeFocused($event)">

这篇关于Ionic 2系列touchend活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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