Socket
Socket
Sign inDemoInstall

@uiw/react-pagination

Package Overview
Dependencies
Maintainers
1
Versions
171
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uiw/react-pagination

> TODO: description


Version published
Weekly downloads
197
increased by17.26%
Maintainers
1
Weekly downloads
 
Created
Source

Pagination 分页

当数据量较多时,使用分页可以快速进行数据切换,每次只加载一个页面。

基本用法

import { Pagination, Divider } from 'uiw';

ReactDOM.render(
  <div>
    <Pagination current={2} pageSize={10} total={30} divider />
    <Divider />
    <Pagination current={2} pageSize={10} total={38} divider />
    <Divider />
    <Pagination current={1} pageSize={5} total={249} />
    <Divider />
    <Pagination current={1} pageSize={10} total={50} />
    <Divider />
    <Pagination current={1} pageSize={10} total={60} divider />
    <Divider />
    <Pagination current={1} pageSize={10} total={70} divider />
  </div>,
  _mount_
);

迷你分页

import { Pagination, Divider } from 'uiw';

ReactDOM.render(
  <div>
    <Pagination size="small" current={1} pageSize={5} total={249} />
    <Divider />
    <Pagination size="small" current={1} pageSize={10} total={50} />
  </div>,
  _mount_
);

对齐

目前有三种对齐方式 左边(left)中间(center)右边(right)

import { Pagination, Divider } from 'uiw';

ReactDOM.render(
  <div>
    <Pagination
      current={5}
      total={250}
      onChange={(pageNumber) => { 
        console.log(`pageNumber:${pageNumber}`)
      }}
    />
    <Divider />
    <Pagination
      current={1}
      alignment="center"
      total={250}
      onChange={(pageNumber) => { 
        console.log(`pageNumber:${pageNumber}`)
      }}
    />
    <Divider />
    <Pagination
      current={25}
      alignment="right"
      total={250}
      onChange={(pageNumber) => { 
        console.log(`pageNumber:${pageNumber}`)
      }}
    />
  </div>,
  _mount_
);

Props

参数说明类型默认值
current当前页数,选中的页数Number1
total数据总数Number0
pageSize每页条数Number10
divider页码之间是否间隔Boolean-
size当为 small 时,是小尺寸分页Enum{small, default}-
alignment对齐Enum{left, center, right}left
onChange页码改变的回调,返回改变后的页码Function(current, total, pageSize)-

FAQs

Package last updated on 01 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc