import React, { Component } from 'react'; import './index.less'; import Icon from '../Icon'; export default class extends Component { onChangePage(page) { const { total, pageSize, onChange } = this.props; const all = Math.ceil(total / pageSize); if (page <= 0 || page > all) return; if (onChange) onChange(page); } render() { const { current, total, pageSize } = this.props; return (
this.onChangePage(current - 1)} /> {current}/{Math.ceil(total / pageSize)} this.onChangePage(current + 1)} />
); } }