onReachBottom方法因为页面卡顿,被多次触发要怎么解决?
发布于 5 年前 作者 hjiang 4346 次浏览 来自 官方Issues

在onReachBottom方法里getList(),被触发多次

2 回复
//应该是加个lock吧?节流时间怎么精确
getList(){
  if(loading) return
  this.loading=true
  request.get("xxxxx").then(res=>{
    this.setData({
      list:res
    },()=>{
      this.loading=false
    })
  })
}

函数节流 (throttle ):限制一个函数在一定时间内只能执行一次

回到顶部