pagination - React-Bootstrap Pagination component adds a random (current) to the current page
问题描述
This is my pagination component
class PaginationComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
maxPage: this.props.maxPage,
activePage: this.props.activePage
}
}
render() {
const items = [];
for (let number = 1; number <= this.state.maxPage; number++) {
items.push(
<Pagination.Item key={number} active={number === this.state.activePage}>
{number}
</Pagination.Item>
);
}
return (
<Pagination>
{items}
</Pagination>
)
}
}
and I'm using it like so
<div>
<PaginationComponent maxPage={5} activePage=1/>
</div>
but somehow it's rendering this instead 1(current), is this an option that I have to disable? I haven't been able to find anything regarding this behavior.
解决方案
将activeLabel = ""
道具添加到Pagination.Item
推荐阅读
- angular - Angular 10 在另一个内部使用组件(错误:不是已知元素)
- javascript - 为什么我的 fetch 在我的服务器上失败,但在本地主机上却没有?并且 array.slice 也会中断 fetch
- r - 将连续轴更改为离散轴并设置轴限制
- python - 为什么pdftotext会抛出DLL加载失败错误,在windows10,python3.7上
- html - 如何在 Ubuntu 上的 VS Code 中格式化 HTML 代码?
- ssh - 如何从需要密钥的第二个远程主机 scp 到本地计算机?
- sql - BigQuery - 从使用复杂 CTE 的查询结果创建表?
- optaplanner - 在多个对象层次结构中设置分配
- java - Kafka Consumer 升级到 Java 15 后无法可靠轮询,Producer 会首先在同一 JVM 中查找和消费最近的记录
- python - 无法模拟 subprocess.check_call