hooks
hooks copied to clipboard
useInfiniteScroll getClientHeight error
trafficstars
想问一下,useInfiniteScroll所使用的getClientHeight这个方法是不是有点问题?这边想获取视窗的高度,应该是使用el.clientHeight || document.documentElement.clientHeight || document.body.clientHeight吧? 经测试,在chrome上document.body.clientHeight会返回body的高度,导致当useInfiniteScroll传入的target为document时,会在未滚动触底的情况下自动触发handler
如何修复这个问题呢?
如何修复这个问题呢?
参考下这里:https://github.com/alibaba/hooks/pull/1516#issuecomment-1075832893
如果限定了body的高度,那么失去了以document为滚动父元素的意义,我使用了该方式:https://github.com/alibaba/hooks/issues/1563
统一在 #2119 中处理