LoadMore
The data structure returned by Service
must include {list: any[]}
. If this is not the case, you can convert it in the Service. Then, you can get the list of data requested by using the dataList
variable returned by us and trigger the loading of more data using loadMore()
.
In addition, we will pass the latest combined data
in the parameters of the Service
function.
Assume that the data returned by the first Service
is { list: [1, 2, 3], current: 1 }
, and the data returned by the second request is { list:[4, 5, 6], current: 2}
. We will automatically merge the lists for you, and the combined data
will be { list: [1, 2, 3, 4, 5, 6], current:2 }
. This combined data
will be passed as input to the Service
function for the third request.
attention
The APIs of useLoadMore
are significantly different from those of useRequest
and usePagination
. For details, please refer to LoadMore Extended APIs.
Usage
import { useLoadMore } from 'vue-request';