Pagination分页

采用分页的形式分隔长列表,每次只加载一个页面。

何时使用#

  • 当加载/渲染所有数据将花费很多时间时;
  • 可切换页码浏览数据。
import { NzPaginationModule } from 'ng-zorro-antd/pagination';

代码演示

基础分页。

expand codeexpand code
加载中

更多分页。

expand codeexpand code
加载中

改变每页显示条目数。

expand codeexpand code
加载中

快速跳转到某一页。

expand codeexpand code
加载中
  • 1
  • 2
  • 3
  • 4
  • 5

  • 1
  • 2
  • 3
  • 4
  • 5
  • 10 条/页
    跳至

  • Total 50 items
  • 1
  • 2
  • 3
  • 4
  • 5
  • 迷你版本。

    expand codeexpand code
    加载中
  • / 5
  • 简单的翻页。

    expand codeexpand code
    加载中

    改变页码。

    expand codeexpand code
    加载中
  • Total 85 items
  • 1
  • 2
  • 3
  • 4
  • 5

  • 1-20 of 85 items
  • 1
  • 2
  • 3
  • 4
  • 5
  • 通过设置 nzShowTotal 展示总共有多少数据。

    expand codeexpand code
    加载中

    修改上一步和下一步为文字链接。

    expand codeexpand code
    加载中

    API#

    <nz-pagination [nzPageIndex]="1" [nzTotal]="50"></nz-pagination>

    nz-pagination#

    参数说明类型默认值全局配置
    [nzTotal]数据总数number--
    [nzPageIndex]当前页数,可双向绑定number1-
    [nzPageSize]每页条数 ,可双向绑定number10-
    [nzDisabled]是否禁用booleanfalse-
    [nzShowQuickJumper]是否可以快速跳转至某页booleanfalse
    [nzShowSizeChanger]是否可以改变 nzPageSizebooleanfalse
    [nzSimple]当添加该属性时,显示为简单分页boolean-
    [nzSize]当为「small」时,是小尺寸分页'small''default'
    [nzResponsive]nzSize 未指定时,根据屏幕宽度自动调整尺寸booleanfalse-
    [nzPageSizeOptions]指定每页可以显示多少条number[][10, 20, 30, 40]
    [nzItemRender]用于自定义页码的结构TemplateRef<{ $implicit: 'page' | 'prev' | 'next'| 'prev_5'| 'next_5', page: number }>--
    [nzShowTotal]用于显示数据总量和当前数据范围,具体使用方式见代码演示部分TemplateRef<{ $implicit: number, range: [ number, number ] }>--
    [nzHideOnSinglePage]只有一页时是否隐藏分页器booleanfalse-
    (nzPageIndexChange)页码改变的回调EventEmitter<number>--
    (nzPageSizeChange)每页条数改变的回调EventEmitter<number>--