Giter VIP home page Giter VIP logo

reactjs-pagination's Introduction

reactjs-pagination

一个react的本地分页组件

version MIT License

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>
		)
	}
}

reactjs-pagination's People

Contributors

monsterooo avatar

Stargazers

Qing avatar chihaicheng avatar Mohammad Ayub avatar qy.yuan avatar  avatar fan.li avatar muggle avatar 跨世_PhotoArtLife avatar  avatar 0xzz avatar

Watchers

James Cloos avatar  avatar  avatar

reactjs-pagination's Issues

页码计算caclePages()有个bug

当页码总数小于middlePage时会出错
viewPageEnd = middlePage + Math.floor(middlePage / 2) 应判断viewPageEnd 是否超出pageCount

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.