Skip to content

Pagination 分页组件 ​

当数据量过多时,使用分页分解数据。

📌平台差异说明 ​

APP(vue)H5微信小程序支付宝小程序
✔✔✔✔

🏯基本使用示例 ​

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

const value = ref<number>(1);

显示图标 ​

  • 通过设置show-icon,将分页导航展示为Icon图标
html
<template>
    <hy-pagination v-model="value" :total="999" show-icon></hy-pagination>
</template>

文字提示 ​

  • 通过设置show-message,展示文字提示
html
<template>
    <hy-pagination v-model="value" :total="999" show-message></hy-pagination>
</template>

一页展示数 ​

  • 通过设置pageSize,显示一页展示数量
html
<template>
    <hy-pagination v-model="value" :total="999" :page-size="20"></hy-pagination>
</template>

设置展示文字 ​

  • 通过设置prevText,显示上一页按钮文本
  • 通过设置nextText,显示下一页按钮文本
html
<template>
    <hy-pagination v-model="value" :total="999" prevText="上" nextText="下"></hy-pagination>
</template>

API ​

Pagination Props ​

参数说明类型默认值
v-model当前页number1
totalPage总页数,如果有total,则优先使用total计算页数number1
showIcon是否展示分页Iconbooleanfalse
showMessage是否展示文字提示booleanfalse
total总数据个数number-
pageSize分页大小number10
prevText上一页按钮文字string上一页
nextText下一页按钮文字string下一页
hideIfOnePage总页数只有一页时是否隐藏booleantrue
customStyle自定义需要用到的外部样式CSSProperties-
customClass自定义外部类名string-

Events ​

事件名说明回调参数
change值修改事件value: value为当前数

CSS 变量 ​

变量名说明默认值
--hy-pagination-nav-min-width上下页按钮最小宽度60px
--hy-pagination-nav-active-color上下页按钮激活色rgba(0, 0, 0, 0.65)
--hy-pagination-nav-disabled-color上下页按钮禁用色rgba(0, 0, 0, 0.15)
--hy-pagination-font-size信息文字字号跟随 --hy-font-size-sm(24rpx)
12:33
battery