Bootstrap

React触底加载

一、使用UseRequest

代码如下:根据Result 的长度,选择跳过的个数。

const {
   
    data: searchData,
    loading,
    reload,
    loadMore,
    noMore
  } = useRequest(
    (d: Result | undefined) =>
      communityService.search(
        searchContent,
        tabKey,
        secKey,
        d?.list.length || 0,
        LIMIT
      ),
    {
   
      manual: true,
      loadMore: true,
      debounceInterval: 10,
      ref: containerRef,
      isNoMore: res 
;