Pagination API
Pagination extension.
const { ...ReturnValues } = usePagination<R, P, FR>(Service, Options);
See also: Pagination
Note
The following API is a superset of Public API. If there are no special instructions, it is consistent with Public API.
Return Values
current
Type:
Ref<number>
Default:
1
Current page number. We listened to this value internally. When you modify the
current
directly, we will trigger thechangeCurrent
method. So you can use it withv-model
.
pageSize
Type:
Ref<number>
Default:
10
The number of items per page. We have monitored this value internally, and when you directly modify the
pageSize
, we will trigger thechangePageSize
method automatically. So you can use it withv-model
.
total
Type:
Ref<number>
Default:
0
The total number of data.
totalPage
Type:
Ref<number>
Default:
0
The total number of pages, you must provide the correct
total
andpageSize
, otherwise, you may get incorrect values.
changeCurrent
Type:
(current: number) => void
Modify the current page number.
changePageSize
Type:
(pageSize: number) => void
Modify the number of entries per page.
New in 1.2.0
changePaginationType:
(current: number, pageSize: number) => void
Modify
pageSize
andcurrent
.
reload
Type:
() => void
Clear all request status and request results (including
data
), and usedefaultParams
to triggerrun()
Not Support
queriesIn paging mode, Concurrent Request is not supported
Options
pagination
Type:
{ currentKey?: string; pageSizeKey?: string; totalKey?: string; totalPageKey?: string; }
Details:
Tips
Both totalKey
and totalPageKey
are implemented using lodash.get
, so the path of the object property is supported to get the value. See also lodash documentopen in new window
pagination Field | Description | Defaults |
---|---|---|
currentKey | You can use this value to specify the attribute value of the interface current page number parameter. | 'current' |
pageSizeKey | You can use this value to specify the interface get the number of items per page the attribute value of the parameter. | 'pageSize' |
totalKey | Specify the path of the total attribute in data . | 'total' |
totalPageKey | Specify the path of the data attribute in totalPage . | 'totalPage' |
Not Support
queryKeyIn paging mode, Concurrent Request is not supported