Pagination 分页器
用于数据翻页的控件,支持移动端轻量模式 (mode="simple")、多数字页码模式 (mode="multi") 与轮播圆点模式 (mode="pointer")。
代码示例
1. 移动端轻量模式 (Simple)
vue
<template>
<mu-pagination v-model="current" :total="100" mode="simple" @change="onChange" />
</template>
<script setup>
import { ref } from 'vue'
const current = ref(1)
const onChange = ({ current }) => console.log('当前页:', current)
</script>2. 多数字页码模式 (Multi)
vue
<template>
<mu-pagination v-model="current" :total="120" mode="multi" />
</template>API 属性说明 (Props)
| 参数名 | 说明 | 类型 | 可选值 | 默认值 |
|---|---|---|---|---|
| v-model / current / modelValue | 当前页码 | Number | - | 1 |
| total | 总条目数量 | Number | - | 0 |
| pageSize | 每页展示条数 | Number | - | 10 |
| pageCount | 直接指定总页数 (优先级高于 total) | Number | - | 0 |
| maxPages | 多数字模式展示的最大页码根数 | Number | - | 5 |
| mode | 分页展现形态 | String | multi | simple | pointer | 'multi' |
| shape | 页码按鈕形状 | String | round | square | 'round' |
| prevText | 上一页按鈕文案 | String | - | '上一页' |
| nextText | 下一页按鈕文案 | String | - | '下一页' |
事件说明 (Events)
| 事件名 | 说明 | 回调参数 |
|---|---|---|
| change | 改变页码时触发 | ({ current: Number, totalPage: Number }) |
| update:modelValue / update:current | v-model 双向绑定更新 | (current: Number) |