1. import React from 'react';
    2. import PropTypes from 'prop-types';
    3. import { Pagination } from 'antd';
    4. import styles from './style.module.less';
    5. const Page = (props) => {
    6. const { totalCount, pagination } = props;
    7. const showTotal = (total) => `共${total}条`;
    8. return (
    9. <div className = {styles.pageWrapper}>
    10. <Pagination
    11. total={totalCount}
    12. showTotal={showTotal}
    13. {...pagination}
    14. />
    15. </div>
    16. );
    17. };
    18. Page.propTypes = {
    19. totalCount: PropTypes.number,
    20. pagination: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
    21. };
    22. Page.defaultProps = {
    23. totalCount: 0,
    24. pagination: false,
    25. };
    26. export default Page;
    27. .pageWrapper {
    28. text-align: center;
    29. margin-top: 7px;
    30. : global {
    31. .ant-pagination-item a {
    32. line-height: 20px;
    33. font-size: 12px;
    34. }
    35. .ant-pagination-total-text {
    36. color: @text-color;
    37. font-size: @font-size-lg;
    38. }
    39. .ant-pagination-item {
    40. border: none !important;
    41. border-radius: @border-radius-lg !important;
    42. min-width: 23px !important;
    43. height: 22px !important;
    44. }
    45. .ant-pagination-item-active {
    46. background: @white !important;
    47. border: 1px solid @primary-color !important;
    48. }
    49. .ant-pagination-item-active a {
    50. color: @primary-color !important;
    51. }
    52. .ant-pagination-prev .ant-pagination-item-link, .ant-pagination-next .antpagination-item-link {
    53. border: none !important;
    54. line-height: 22px !important;
    55. }
    56. }
    57. }
    58. // 用法 定义pagination
    59. const pagination = {
    60. current: _.get(data, 'pageNum'),
    61. pageSize: _.get(data, 'pageSize'),
    62. onChange,
    63. showSizeChanger: false,
    64. hideOnSinglePage: true,
    65. };