fix: scrollY未定义
This commit is contained in:
parent
4554f26ff7
commit
b08ee805bc
|
@ -194,7 +194,12 @@ export default class InfiniteScroll extends Component {
|
||||||
* @description 根据返回的scrollTop计算当前的索引。
|
* @description 根据返回的scrollTop计算当前的索引。
|
||||||
*/
|
*/
|
||||||
handleScrollY = () => {
|
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根据定高算的。在非固定高下,这个只是一个大概的值。
|
//默认显示20条,rowsInView根据定高算的。在非固定高下,这个只是一个大概的值。
|
||||||
this.rowsInView = scrollY ? Math.floor(scrollY / rowHeight) : CONFIG.defaultRowsInView;
|
this.rowsInView = scrollY ? Math.floor(scrollY / rowHeight) : CONFIG.defaultRowsInView;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue