【发布时间】:2021-05-18 14:35:30
【问题描述】:
大家好,我正在尝试使用 InfiniteScroll 和 react-infinite-scroll-component 包实现反向滚动分页,但无法这样做。正常向下滚动分页正在工作,但反向滚动是 没有触发我在脚本中定义的方法 fetchMoreData2,即使没有显示错误。请指导我。
<div
id="scrollableDiv2"
style={{
height: 300,
overflow: 'auto',
display: 'flex',
flexDirection: 'column-reverse',
}}
>
<InfiniteScroll
dataLength={this.state.listData.length}
next={this.fetchMoreData2}
scrollableTarget="scrollableDiv2"
inverse={true}
hasMore={true}
style={{ display: 'flex', flexDirection: 'column-reverse' }}
>
<ul>
{this.getList()}
</ul>
</InfiniteScroll>
</div>
【问题讨论】: