Skip to content
iuiDesign
100%
02:32
本页目录

采用分页控制单页内的信息数量。

基本使用

分页的基本用法,total 属性为必填项。

html
<iui-pagination :total="50" />
<iui-pagination :total="50" />

文字模式

文字模式下,可以通过 prevTextnextText 属性来自定义上一页和下一页的文字。

html
<iui-pagination :total="50" type="text" />
<iui-pagination :total="50" type="text" />

图标模式

图标模式会使 pagination 看起来更简洁。

html
<iui-pagination :total="50" type="icon" />
<iui-pagination :total="50" type="icon" />

自定义内容

可以通过 prevvaluenext 插槽可以满足自定义内容的需求。

html
<iui-pagination :total="50">
  <template #prev>
    <view class="circle">
      <iui-icon name="left"></iui-icon>
    </view>
  </template>

  <template #value="{ current }">
    <view class="value"> 第 {{ current }} 页 </view>
  </template>

  <template #next>
    <view class="circle">
      <iui-icon name="right"></iui-icon>
    </view>
  </template>
</iui-pagination>
<iui-pagination :total="50">
  <template #prev>
    <view class="circle">
      <iui-icon name="left"></iui-icon>
    </view>
  </template>

  <template #value="{ current }">
    <view class="value"> 第 {{ current }} 页 </view>
  </template>

  <template #next>
    <view class="circle">
      <iui-icon name="right"></iui-icon>
    </view>
  </template>
</iui-pagination>
css
.circle {
  background-color: rgb(229, 229, 229);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  text-align: center;
  color: gray;
}
.value {
  background-color: #165dff;
  border-radius: 4px;
  font-size: 13px;
  padding: 2px 8px;
  color: white;
}
.circle {
  background-color: rgb(229, 229, 229);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  text-align: center;
  color: gray;
}
.value {
  background-color: #165dff;
  border-radius: 4px;
  font-size: 13px;
  padding: 2px 8px;
  color: white;
}

API

<Pagination>props
参数描述类型默认值
modelValue (v-model)当前页码Number1
total总数Number0
pageSize每页条数Number10
prevText上一页文本String上一页
nextText下一页文本String下一页
type样式类型button | text | iconbutton
justify通栏显示Booleantrue
<Pagination>events
事件名描述参数
change页码改变时触发(modelValue)
<Pagination>slots
插槽名描述参数
prev上一页-
next下一页-
value当前页码(current: Number, page: Number, pageSize: Number )