首页 > 解决方案 > 如何在反应虚拟化中限制 onScroll 功能?

问题描述

我有代码示例。当我用鼠标滚动窗口时,每次当 scrollTop === 0 工作时我的函数 this.handle。如何限制 this.handleScroll 上的 this.handle 函数?

https://codesandbox.io/s/n3117pxvp0

标签: reactjsreact-virtualized

解决方案


在构造函数中,我将此函数与节流阀绑定,如下所示:

    this.handle = throttle(this.handle, 500);

推荐阅读