【问题标题】:How to know if the pointer is going to left or right in ionic-angular range component如何知道指针在离子角度范围分量中是向左还是向右
【发布时间】:2019-01-19 05:19:46
【问题描述】:

我不知道是否有办法在离子范围组件上找到指针方向。我的意思是指针是向左还是向右?

感谢您的帮助

【问题讨论】:

  • 你尝试了什么?如果我是你,我会检查 ionChange 事件,看看它是否包含你需要的东西,如果不是直接,你可以计算值之间的增量并得出它的去向。

标签: angular ionic-framework ionic3 angular-components


【解决方案1】:

好吧,你可以这样做:

https://stackblitz.com/edit/ionic-qnxrnv

基本上你有你的范围(我使用默认值,即 0 到 100 个值):

你绑定方法来检测运动:

sliderValueChanged(event) {
    // if current slider value exist we can do comparision:
    if (this.currentSliderValue && (this.currentSliderValue > event.value)) {
      console.log("moving left");
    } else {
      console.log("moving right")
    }
    // now we capture result
    this.currentSliderValue = event.value
  }

根据您的用例,您可能需要考虑值等于等时的不同情况

【讨论】:

  • 非常感谢。这就是我想要的!
猜你喜欢
  • 1970-01-01
  • 2011-03-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多