-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS使用fastclick的情况下,下拉刷新会触发点击事件 #27
Comments
在mint-ui源码 找到loadmore 相关代码 ,在handleTouchEnd 里面加上event.preventDefault(); |
使用loadmore组件时,手势横向滑屏,稍微倾斜就会触发下拉更新。如何控制手势的方向,让用户只有比较明显的下拉手势时,才触发下拉更新。请帮忙解答一下,谢谢。 |
@uncleLian 方法2:如果同时有上下左右的滑动,建议在源码增加一个属性,用于左右滑动(我左右滑动用的是vue-awsome-swiper)回调中禁止下拉。针对方法2,有代码可以参考一下么,谢谢了。 |
@uncleLian 你好可是我完成了修改但是没有生效,,请问这是为什么! |
@bigy6241 @victorylin 基于Loadmore组件的一些问题,我花了点时间,写了篇博文集中总结一下,可以看看。如还有其他问题,请详细列出,可以帮忙看看。http://liansixin.win/2017/08/01/mint-ui/ |
我遇到了一个悲伤 的问题,就是修改源码不生效, var distance = (this.currentY - this.startY) / this.distanceIndex;
var distanceX = (this.currentX - this.startX) / this.distanceIndex;
if (this.direction === 'down' && this.getScrollTop(this.scrollEventTarget) === 0 && this.translate > 0) {
e.preventDefault();
e.stopPropagation();
this.topDropped = true;
if (Math.abs(distanceX) < 100 && Math.abs(distance) > 5 &&this.topStatus === 'drop') {
this.translate = '0';
this.topStatus = 'loading';
this.topMethod();
} else {
this.translate = '0';
this.topStatus = 'pull';
}
}
if (this.direction === 'up' && this.bottomReached && this.translate < 0) {
e.preventDefault();
e.stopPropagation();
this.bottomDropped = true;
this.bottomReached = false;
if (Math.abs(distanceX) < 100 && Math.abs(distance) > 5 &&this.bottomStatus === 'drop') {
this.translate = '0';
this.bottomStatus = 'loading';
this.bottomMethod();
} else {
this.translate = '0';
this.bottomStatus = 'pull';
}
} 因为我这里在测试的时候直接放在touchend中的时候会直接吧fastclick的所有事件都阻止掉 |
我也碰到这个坑了,但是也有不用改源码的方式。 因为滚动触发了
写在最后:在 所以才有了这个方案:所有的点击都触发在覆盖元素的那一层,而 |
@acccco 你的思路可以结合derectives解决 |
@uncleLian 其实通过加大distance的临界值来判断是不太合适的,我认为应该判断滑动的角度来判断是应该垂直滑动还是水平滑动。我修改代码的步骤是这样的: this.startX = event.touches[0].clientX; 2.在handleTouchMove方法中,修改为 this.currentY = event.touches[0].clientY;
this.currentX = event.touches[0].clientX;
const diffX = this.currentX - this.startX;
const diffY = this.currentY - this.startY;
if (Math.abs(diffX) / Math.abs(diffY) > Math.tan(30 * Math.PI/180)) {
return;
} 此外,我是修改lib/loadmore/index.js文件后才生效的 |
在iOS平台使用fastclick来解决延迟问题,但是在下拉刷新、上拉加载下一页,都会触发列表项目的点击事件,导致进入详情页了,这个如何解决?
The text was updated successfully, but these errors were encountered: