export default function debounce(fn, wait) {
  var timeout;
  return function() {
    var ctx = this, args = arguments;
    clearTimeout(timeout);
    timeout = setTimeout(function() {
      fn.apply(ctx, args);
    }, wait);
  };
}

引用

onLoad() {
    this.scroll = debounce(this.scroll.bind(this), 100);
  },

  scroll(e) {
    this.setData({
      scrollTop: e.detail.scrollTop,
    });
  },

07-19 15:38