React 的本地分页组件 Reactjs-Pagination

码农软件 · 软件分类 · 网页组件 · 2019-04-08 23:42:29

软件介绍

Reactjs-Pagination是一个React的本地分页组件,支持页码、跳转、和迷你模式。文档

安装

npm install --save reactjs-pagination

使用示例代码:

import React, { Component } from 'react';
import { Pagination }from 'reactjs-pagination';
 
class Test extends Component {
    state = {
        totalNumber: 326,
        pageSize: 10,
        currentPage: 31
    };
    constructor(props) {
        super(props);
        setTimeout(() => {
            // this.setState({ 
            // 	currentPage: 15 
            // }); 
            this.setState({
                totalNumber: 125
            });
        }, 3000);
    }
    handleChange = (idx) => {
        console.log('页码改变 => ', idx);
    }
    render() {
        const { totalNumber, pageSize, currentPage } = this.state;
 
        return (
            <div>
                <Pagination
                    totalNumber={totalNumber}
                    pageSize={pageSize}
                    currentPage={currentPage}
                    middlePage={5}
                    onChange={this.handleChange}
                    showPages
                    showGo
                />
            </div>
        )
    }
}

本文地址:https://codercto.com/soft/d/3171.html

Build Your Own Web Site the Right Way Using HTML & CSS

Build Your Own Web Site the Right Way Using HTML & CSS

Ian Lloyd / SitePoint / 2006-05-02 / USD 29.95

Build Your Own Website The Right Way Using HTML & CSS teaches web development from scratch, without assuming any previous knowledge of HTML, CSS or web development techniques. This book introduces you......一起来看看 《Build Your Own Web Site the Right Way Using HTML & CSS》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

随机密码生成器
随机密码生成器

多种字符组合密码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具