LoadMore

The data structure returned by Service must contain {list: any[]} . If it is not satisfied, you can replace it in the Service by yourself. Then through the dataList variable we returned, you can get the requested data list collection, and then use [loadMore()] (../../api/loadMore.html#loadmore) Triggers to load more.

In addition, we will pass the latest integrated data in the parameter of the Service function.

Suppose the data returned by Service for the first time is { list: [1, 2, 3], current: 1 }, the second time returns The data is { list:[4, 5, 6], current: 2}, then we will automatically merge the list for you, and the integrated data is { list: [1, 2, 3, 4, 5, 6], current: 2 }. And this integrated data will be used as the input parameter of Service in the third request.

attention

The API of useLoadMore is very different from that of useRequest and usePagination. For details, see LoadMore Extension API

Usage

import { useLoadMore } from 'vue-request';

Example

Last Updated: 7/1/2022, 8:28:34 AM
Contributors: John