LoadMore API
LoadMore extension.
const { ...ReturnValues } = useLoadMore<R>(Service, Options);
TS Type description
type DataType = { list: any[]; [key: string]: any };
See also: LoadMore
Service
Request methods
Type:
(data?: DataType) => Promise<DataType>Details:
- The data returned by
Servicemust contain an array namedlist, with the type of{ list: any[], ...other }. - The input parameters of
Serviceare the latest integrateddata.
- The data returned by
Return Values
data
Type:
shallowRef<DataType>Default:
[]The data returned by
Servicemust contain an array namedlist, with the type of{ list: any[], ...other }. Thelistproperty contains the aggregated data.
dataList
Type:
Ref<DataType['list']>Default:
[]The
listarray indata.
error
Type:
shallowRef<Error>Default:
[]Errors returned by
Service.
loading
Type:
Ref<boolean>Default:
falseWhether the request is in progress.
loadingMore
Type:
Ref<boolean>Default:
falseWhether it is currently loading more data.
noMore
Type:
Ref<boolean>Default:
falseWhether it is currently loading more data. It needs to be used with
isNoMore.
loadMore
Type:
() => voidDefault:
0Load more data. It will automatically catch exceptions and handle them through
options.onError.
loadMoreAsync
Type:
() => Promise<DataType>It is used in the same way as
loadMore, but it returns aPromiseand you need to handle exceptions yourself.
refresh
Type:
() => voidReloads the first page of data. It will automatically catch exceptions and handle them through
options.onError.
refreshAsync
Type:
() => voidIt is used in the same way as
refresh, but it returns aPromiseand you need to handle exceptions yourself.
mutate
Type:
(arg: (oldData: DataType) => DataType) => void | (newData: DataType) => voidThe result of directly modifying
data.
cancel
Type:
() => voidCancel request.
Options
isNoMore
Type:
(data: R) => booleanDefault:
falseDetails:
Check if there is more data available.
manual
Type:
booleanDefault:
falseDetails:
When set to
true, you need to manually triggerloadMoreorloadMoreAsyncto initiate the request.
ready reactivity
Type:
Ref<boolean>Default:
falseDetails:
Same as ready in
useRequest
refreshDeps
Type:
WatchSource<any>[]Default:
[]Details:
Same as refreshDeps in
useRequest
refreshDepsAction
Type:
() => voidDetails:
Same as refreshDepsAction of
useRequest
debounceInterval reactivity
Type:
number | Ref<number>Default:
undefinedDetails:
Same as debounceInterval in
useRequest
debounceOptions reactivity
Type:
DebounceOptions | Reactive<DebounceOptions>Details:
Same as debounceOptions in
useRequest
throttleInterval reactivity
Type:
number | Ref<number>Default:
undefinedDetails:
Same as throttleInterval in
useRequest
throttleOptions reactivity
Type:
ThrottleOptions | Reactive<ThrottleOptions>Details:
Same as throttleOptions in
useRequest
errorRetryCount reactivity
Type:
number | Ref<number>Default:
0Details:
Same as errorRetryCount in
useRequest
errorRetryInterval reactivity
Type:
number | Ref<number>Default:
0Details:
Same as errorRetryInterval in
useRequest
onBefore
Type:
() => voidDetails:
Triggered before the execution of
Service.
onAfter
Type:
() => voidDetails:
Triggered when
Serviceexecution is completed.
onSuccess
Type:
(data: DataType) => voidDetails:
Triggered when
Serviceresolves, with thedataparameter.
onError
Type:
(error: Error) => voidDetails:
Triggered when
Servicerejects, with theerrorparameter.
