我已经使用以下命令安装了 react-pagination:-
npm i react-bootstrap-4-pagination
我的代码:-
import React, { Component } from "react";
import { Link } from "react-router-dom";
import Pagination from 'react-pagination';
let paginationConfig = {
totalPages: 22,
currentPage: 15,
showMax: 5,
size: "lg",
threeDots: true,
prevNext: true,
href: 'https://example.com/items?page=*', // * will be replaced by the page number
pageOneHref: 'https://example.com/items',
borderColor: 'red',
activeBorderColor: 'black',
activeBgColor: 'grey',
disabledBgColor: 'red',
activeColor: 'red',
color: 'purple',
disabledColor: 'green',
circle: true,
shadow: true
};
<Pagination
threeDots
totalPages={22}
currentPage={15}
showMax={7}
prevNext
activeBgColor="#18eaca"
activeBorderColor="#7bc9c9"
/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>
答案将不胜感激!