diff --git a/src/infiniteScroll.js b/src/infiniteScroll.js index 8605f8f..0e31ab7 100644 --- a/src/infiniteScroll.js +++ b/src/infiniteScroll.js @@ -194,7 +194,12 @@ export default class InfiniteScroll extends Component { * @description 根据返回的scrollTop计算当前的索引。 */ handleScrollY = () => { - let rowHeight = this.props.store.getState().rowHeight; + const parentElement = this.getParentElement(this.scrollComponent); + if (!parentElement) { + return; + } + let scrollEl = parentElement; + let scrollY = scrollEl && scrollEl.clientHeight; //默认显示20条,rowsInView根据定高算的。在非固定高下,这个只是一个大概的值。 this.rowsInView = scrollY ? Math.floor(scrollY / rowHeight) : CONFIG.defaultRowsInView;