123456789101112131415161718192021222324 |
- import React, { Component } from 'react';
- import './index.less';
- import Icon from '../Icon';
- export default class extends Component {
- onChangePage(page) {
- const { current, total, onChange } = this.props;
- if (page < current || page > total) return;
- if (onChange) onChange(page);
- }
- render() {
- const { current, total } = this.props;
- return (
- <div className="user-pagination">
- <Icon name="arrow-left-small" onClick={() => this.onChangePage(current - 1)} />
- <span>
- <b>{current}</b>/{total}
- </span>
- <Icon name="arrow-right-small" onClick={() => this.onChangePage(current + 1)} />
- </div>
- );
- }
- }
|