nutui-react icon indicating copy to clipboard operation
nutui-react copied to clipboard

[FR]: InfiniteLoading组件 下拉刷新、上拉加载状态受控

Open Phyzait opened this issue 2 years ago • 0 comments

这个功能解决了什么问题?

目前仅能通过手动操作开启,状态不能完全受控,希望添加类似于loadingloadingMore的状态参数,让加载状态可被开发者自由控制

你期望的组件设计是怎样的?

  const onRefresh = async () => {
    setLoading(true);
    await load();
    setLoading(false);
  };

  const onLoadMore = async () => {
    setLoadingMore(true);
    await load();
    setLoadingMore(false);
  };

  return (
    <InfiniteLoading
      pullRefresh
      onRefresh={onRefresh}
      onLoadMore={onLoadMore}
      loading={loading}
      loadingMore={loadingMore}
    >
     ...
    </InfiniteLoading>
);

Phyzait avatar Aug 23 '23 07:08 Phyzait