Skip to content

分页 Pagination

用于数据分页展示,支持自定义布局、多种尺寸、页码跳转和每页条数切换。

基础用法

通过 total 设置总条数,page-size 设置每页条数,v-model 绑定当前页。

  • 共 30 条
  • 1
  • 2
  • 3
  • 前往
vue
<template>
  <bp-pagination :total="30" :page-size="10" :current></bp-pagination>
</template>

<script setup lang="ts">
import { ref } from "vue";
const current = ref(1);
</script>

尺寸

通过 size 属性设置尺寸,支持 minismalldefaultlarge

  • 共 30 条
  • 1
  • 2
  • 3
  • 前往
  • 共 30 条
  • 1
  • 2
  • 3
  • 前往
  • 共 30 条
  • 1
  • 2
  • 3
  • 前往
  • 共 30 条
  • 1
  • 2
  • 3
  • 前往
vue
<template>
  <bp-space type="vertical">
    <bp-pagination
      v-for="size in sizesList"
      :key="size"
      :total="30"
      :page-size="10"
      :current="1"
      :size
    ></bp-pagination>
  </bp-space>
</template>

<script setup lang="ts">
const sizesList = ["mini", "small", "default", "large"];
</script>

自定义布局

通过 layout 属性自定义分页布局,可选值:totalprevpagernextsizesjumper

自定义布局
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 20
带总数和跳转
  • 共 200 条
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 20
  • 前往
完整布局
  • 共 200 条
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 20
  • 前往
vue
<template>
  <div>
    <div class="label">自定义布局</div>
    <bp-pagination :total="200" :page-size="10" v-model="current" layout="prev, pager, next" />
    <div class="label" style="margin-top: 16px">带总数和跳转</div>
    <bp-pagination :total="200" :page-size="10" v-model="current" layout="total, prev, pager, next, jumper" />
    <div class="label" style="margin-top: 16px">完整布局</div>
    <bp-pagination :total="200" :page-size="10" v-model="current" />
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";

const current = ref(1);
</script>

<style scoped>
.label {
  font-size: 13px;
  color: #86909c;
  margin-bottom: 6px;
}
</style>

Pagination 属性

layout布局配置
String
total, prev, pager, next, sizes, jumper-
disabled是否禁用
Boolean
--
size尺寸
InputSize
default-
total总条数
Number
--
current当前页
Number
1-
page-size每页条数
Number
10-
sizes-list可选页数列表
Array
[10, 20, 50, 100]-
prev-text上一页文本
String
--
next-text下一页文本
String
--
max-pager最多页码数
Number
7-
total-tmp-string总数文案
String
共 {total} 条-
jumper-tmp-string跳转文案
String
前往{jumper}-
sizes-tmp-string分页大小文案
String
{value} 条/页-

Pagination 事件

change页码变化page: number-
size-change分页大小变化pageSize: number-