1.0.9 • Published 6 months ago

rc-infinite-pagination v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

rc-infinite-pagination 无限分页组件

npm.io npm.io npm.io npm.io

rc-infinite-pagination is a infinite pagination component for React that doesn't require total page or count. You don't care about how many pages in a given list view, and just go-to-next and so forth till there's no data shown.

rc-infinite-pagination是React的无限分页组件,它不需要分页总数。你不需要关心列表页面中有多少数据,只需要前后翻页,直到没有显示数据为止。

screenshot

安装 Install

npm install rc-infinite-pagination -S
# or with yarn
yarn add rc-infinite-pagination

示例 Usage

Example: https://codesandbox.io/s/rc-infinite-pagination-y3xt2

基本 Basic

import InfinitePagination from 'rc-infinite-pagination'

const App = () => {
  return (
    <InfinitePagination
      current={current}
      onChange={handleChange}
      pageData={pageData}
    />
  );
};

自定义文本 Customize text

import InfinitePagination from 'rc-infinite-pagination'

const App = () => {
  return (
    <InfinitePagination
      current={current}
      onChange={handleChange}
      pageData={pageData}
      pageSize={pageSize}
      prevText="prev"
      nextText="next"
    />
  );
};

自定义上、下页结构 Customize prev and next

import InfinitePagination from 'rc-infinite-pagination'

const App = () => {
  return (
    <InfinitePagination
      current={current}
      onChange={handleChange}
      pageData={pageData}
      pageSize={pageSize}
      prev={prev}
      next={next}
    />
  );
};

自定义类名 Customize className: "float right"

import InfinitePagination from 'rc-infinite-pagination'

const App = () => {
  return (
    <InfinitePagination
      current={current}
      onChange={handleChange}
      pageData={pageData}
      pageSize={pageSize}
      className="fr"
    />
  );
};

API

参数 Props

名称 Name类型Type描述 Description默认值 Default
currentNumber当前页数 The current number of pages1
pageSizeNumber每页应展示条数 The number of items should be displayed per page10
pageDataArray每页数据 data items per page[]
classNameString分页容器类名 The class name of the container of the pagination n-
onChange(current) => void页码改变的回调 The callback executed when the page number is changed-
prevTextReactNode上一页文字 The text of the previous page<>&lt;</>
nextTextReactNode下一页文字 The text of the next page<>&lt;</>
prevReactNode自定义渲染上一页按钮 The component to render the previous button-
nextReactNode自定义渲染下一页按钮 The component to render the next button-
firstReactNode自定义渲染首页按钮 The component to render the first button-
1.0.9

6 months ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.3

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago