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
Service
must contain an array namedlist
, with the type of{ list: any[], ...other }
. - The input parameters of
Service
are the latest integrateddata
.
- The data returned by
Return Values
data
Type:
shallowRef<DataType>
Default:
[]
The data returned by
Service
must contain an array namedlist
, with the type of{ list: any[], ...other }
. Thelist
property contains the aggregated data.
dataList
Type:
Ref<DataType['list']>
Default:
[]
The
list
array indata
.
error
Type:
shallowRef<Error>
Default:
[]
Errors returned by
Service
.
loading
Type:
Ref<boolean>
Default:
false
Whether the request is in progress.
loadingMore
Type:
Ref<boolean>
Default:
false
Whether it is currently loading more data.
noMore
Type:
Ref<boolean>
Default:
false
Whether it is currently loading more data. It needs to be used with
isNoMore
.
loadMore
Type:
() => void
Default:
0
Load 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 aPromise
and you need to handle exceptions yourself.
refresh
Type:
() => void
Reloads the first page of data. It will automatically catch exceptions and handle them through
options.onError
.
refreshAsync
Type:
() => void
It is used in the same way as
refresh
, but it returns aPromise
and you need to handle exceptions yourself.
mutate
Type:
(arg: (oldData: DataType) => DataType) => void | (newData: DataType) => void
The result of directly modifying
data
.
cancel
Type:
() => void
Cancel request.
Options
isNoMore
Type:
(data: R) => boolean
Default:
false
Details:
Check if there is more data available.
manual
Type:
boolean
Default:
false
Details:
When set to
true
, you need to manually triggerloadMore
orloadMoreAsync
to initiate the request.
reactivity
readyType:
Ref<boolean>
Default:
false
Details:
Same as ready in
useRequest
refreshDeps
Type:
WatchSource<any>[]
Default:
[]
Details:
Same as refreshDeps in
useRequest
refreshDepsAction
Type:
() => void
Details:
Same as refreshDepsAction of
useRequest
reactivity
debounceIntervalType:
number | Ref<number>
Default:
undefined
Details:
Same as debounceInterval in
useRequest
reactivity
debounceOptionsType:
DebounceOptions | Reactive<DebounceOptions>
Details:
Same as debounceOptions in
useRequest
reactivity
throttleIntervalType:
number | Ref<number>
Default:
undefined
Details:
Same as throttleInterval in
useRequest
reactivity
throttleOptionsType:
ThrottleOptions | Reactive<ThrottleOptions>
Details:
Same as throttleOptions in
useRequest
reactivity
errorRetryCountType:
number | Ref<number>
Default:
0
Details:
Same as errorRetryCount in
useRequest
reactivity
errorRetryIntervalType:
number | Ref<number>
Default:
0
Details:
Same as errorRetryInterval in
useRequest
onBefore
Type:
() => void
Details:
Triggered before the execution of
Service
.
onAfter
Type:
() => void
Details:
Triggered when
Service
execution is completed.
onSuccess
Type:
(data: DataType) => void
Details:
Triggered when
Service
resolves, with thedata
parameter.
onError
Type:
(error: Error) => void
Details:
Triggered when
Service
rejects, with theerror
parameter.