Skip to content

Pagination ​

When the data volume is too large, use pagination to break up the data.

📌 Platform Compatibility ​

APP(vue)H5WeChat Mini ProgramAlipay Mini Program
✔✔✔✔

🏯 Basic Usage ​

html
<!-- Global usage -->
<hy-pagination v-model="value" :total="999"></hy-pagination>
ts
import { ref } from 'vue';

const value = ref<number>(1);

Show Icons ​

  • By setting show-icon, the pagination navigation is displayed as icons
html
<template>
    <hy-pagination v-model="value" :total="999" show-icon></hy-pagination>
</template>

Text Tips ​

  • By setting show-message, text tips are displayed
html
<template>
    <hy-pagination v-model="value" :total="999" show-message></hy-pagination>
</template>

Items Per Page ​

  • By setting pageSize, the number of items displayed per page is configured
html
<template>
    <hy-pagination v-model="value" :total="999" :page-size="20"></hy-pagination>
</template>

Set Display Text ​

  • By setting prevText, the previous page button text is displayed
  • By setting nextText, the next page button text is displayed
html
<template>
    <hy-pagination v-model="value" :total="999" prevText="Prev" nextText="Next"></hy-pagination>
</template>

API ​

Pagination Props ​

ParameterDescriptionTypeDefault Value
v-modelCurrent pagenumber1
totalPageTotal number of pages; if total is set, it takes priority when calculating the page countnumber1
showIconWhether to show pagination iconsbooleanfalse
showMessageWhether to show text tipsbooleanfalse
totalTotal number of data itemsnumber-
pageSizePage sizenumber10
prevTextPrevious page button textstringPrevious Page
nextTextNext page button textstringNext Page
hideIfOnePageWhether to hide when there is only one pagebooleantrue
customStyleCustom external styles to be appliedCSSProperties-
customClassCustom external class namestring-

Events ​

Event NameDescriptionCallback Parameter
changeValue change eventvalue: the current page number

CSS Variables ​

Variable NameDescriptionDefault Value
--hy-pagination-nav-min-widthMinimum width of the previous/next page buttons60px
--hy-pagination-nav-active-colorActive color of the previous/next page buttonsrgba(0, 0, 0, 0.65)
--hy-pagination-nav-disabled-colorDisabled color of the previous/next page buttonsrgba(0, 0, 0, 0.15)
--hy-pagination-font-sizeFont size of the info textFollows --hy-font-size-sm (24rpx)
12:33
battery