Skip to content

Pagination Component

When there is too much data, use pagination to break it down.

📌 Platform Compatibility

APP(vue)H5WeChat Mini ProgramAlipay Mini Program

🏯 Basic Usage Example

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 Prompt

  • By setting show-message, display a text prompt
html
<template>
    <hy-pagination v-model="value" :total="999" show-message></hy-pagination>
</template>

Items per Page

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

Set Display Text

  • By setting prevText, display the previous page button text
  • By setting nextText, display the next page button text
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 provided, it takes precedence when calculating the page countnumber1
showIconWhether to show pagination iconsbooleanfalse
showMessageWhether to show the text promptbooleanfalse
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 page in totalbooleantrue
customStyleCustom external styles to be appliedCSSProperties-
customClassCustom external class namestring-

Events

Event NameDescriptionCallback Parameter
changeValue change eventvalue: value is the current page number
03:29