mint-UI上拉加载下拉刷新和fastclick冲突问题解决

当我们的Vue项目为了解决IOS设备事件点击卡顿,300ms的延迟的问题,引入了fastclick后,会有很多小的冲突,例如在使用mint-UI实现上拉加载和下拉刷新的时候,经常会触碰到点击事件进入下一个页面,这是因为去掉300毫秒的延迟就会使得页面特别灵敏,想着用阻止冒泡的方式来解决。

在/node_modules\mint-ui\lib\loadmore\index.js和mint-ui.common.js中handleTouchEnd: function handleTouchEnd(event) {...}中添加如下红色代码:

if (this.direction === 'down' && this.getScrollTop(this.scrollEventTarget) === 0 && this.translate > 0) {

event.preventDefault();

event.stopPropagation();

if (this.direction === 'up' && this.bottomReached && this.translate < 0) {

event.preventDefault();

event.stopPropagation();

猜你喜欢

转载自blog.csdn.net/dt1991524/article/details/84818326