angular - 如何知道指针在离子角范围分量中是向左还是向右
问题描述
我不知道是否有办法在离子范围组件上找到指针方向。我的意思是指针是向左还是向右?
谢谢你的帮助
解决方案
好的,这是你可以做到的:
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
}
根据您的用例,您可能需要考虑值等于等时的不同情况
推荐阅读
- google-cloud-platform - 为 terraform 设置 gcs 后端的问题
- node.js - 使用 fetch API 处理 XML 请求
- javascript - 使用 JS 时字体真棒图标和面板无法正确显示
- docker - 使用 2 个不同版本和端口号运行弹性搜索 docker 时出现问题
- authentication - 在 django rest 框架中使用“令牌”作为身份验证方案的动机是什么?
- javascript - 使用 Javascript 的表搜索功能
- css - Emojione 区域定义的 textarea 没有任何覆盖的 CSS 修复
- python - 用二等分法计算wavefcn的基态能量
- apache-kafka - 如何在 Spring Kafka 中确认 container.stop 上的特定偏移量?
- docker - 无法创建 docker 映像`无法启动虚拟机,因为未安装必需的功能。`