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 the changeCurrent method. So you can use it with v-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 the changePageSize method automatically. So you can use it with v-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 and pageSize, 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.

changePagination New in 1.2.0

  • Type: (current: number, pageSize: number) => void

    Modify pageSize and current.

reload

  • Type: () => void

    Clear all request status and request results (including data), and use defaultParams to trigger run()

queries Not Support

In 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 FieldDescriptionDefaults
currentKeyYou can use this value to specify the attribute value of the interface current page number parameter.'current'
pageSizeKeyYou can use this value to specify the interface get the number of items per page the attribute value of the parameter.'pageSize'
totalKeySpecify the path of the total attribute in data.'total'
totalPageKeySpecify the path of the data attribute in totalPage.'totalPage'

queryKey Not Support

In paging mode, Concurrent Request is not supported

Last Updated: 2/11/2022, 8:31:25 AM
Contributors: John