scroll-view bindscrolltolower 多次执行
发布于 6 年前 作者 jiaxiulan 12617 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

使用scroll-view做了一个下拉加载的事件,但是用户在滑动到底部之后还是一直在那边向上滑的时候每滑动一次会去触发一次bindscrolltolower事件,

  • 预期表现

在一次触底之后应该只执行一次事件,而不是多次执行事件

  • 复现路径
  • 提供一个最简复现 Demo

lower: function(e) {

var that = this;

var page = that.data.page

page = page + 1

wx.showLoading({

title: ‘正在加载中’,

mask: true

})

that.setData({

page: page

})

console.log(page);

if (that.data.totalcount > that.data.orderList.length) {

console.log(1);

} else {

that.setData({

page: page - 1

})

wx.hideLoading();

}

},

2 回复

可以了,谢了

设置一个开关,执行的时候为false,不执行的时候变为true  这样就可以解决多次执行的问题了

回到顶部