angular - 分页引导当前页面角度的颜色
问题描述
我想改变分页的颜色当在当前页面和当你在第一页或最后一页时分页将禁用
像这样禁用:
应用程序.html
<ul *ngIf="(ticket$| async)?.length != 0" class="pagination justify-content-end">
<li class="page-item">
<a class="page-link" (click)="previousIndex()">Previous<span aria-hidden="true">«</span></a>
</li>
<li *ngFor="let i of getArrayFromNumber((ticket$| async)?.length); let in = index" class="page-item">
<a class="page-link" (click)="updateIndex(in)">{{in+1}}<span class="sr-only">(current)</span></a>
</li>
<li class="page-item">
<a class="page-link" (click)="nextIndex()">Next</a>
</li>
</ul>
应用程序.ts
getArrayFromNumber(length) {
this.max = (Math.ceil(length / 7))
return new Array(Math.ceil(this.max));
}
updateIndex(pageIndex) {
this.startIndex = pageIndex * 7;
this.endIndex = this.startIndex + 7;
}
previousIndex() {
if (this.tabindex > 0) {
this.tabindex -= 1
}
this.startIndex = this.tabindex * 7;
this.endIndex = this.startIndex + 7;
}
nextIndex() {
if (this.tabindex < this.max - 1) {
this.tabindex += 1
}
this.startIndex = this.tabindex * 7;
this.endIndex = this.startIndex + 7;
}
解决方案
在您的 css 文件中添加以下 CSS。例如,我为当前活动页面使用了橙色背景色,您可以根据需要更改为任何颜色。
.pagination > .active > a , .pagination > .active > a:hover, .pagination > .active > a:focus {
background-color: orange;
border-color: orange;
}
推荐阅读
- mysql - Mysql在使用索引标准自我加入表时不使用索引
- html - Bootstrap align-items 无法按预期工作
- npm - Ember:运行 ember serve 时出错
- dart - 从坐标中获取阿拉伯语地址行
- jenkins - Jenkins崩溃或关闭后如何自动重启?
- node.js - Visual Studio 代码调试器未附加由 express 生成器生成的示例 express 项目
- jquery - 如何获取数据表中自动填充单元格的类名?
- javascript - 将选择范围扩展到 Unicode 文本上的字边界
- arrays - Json 提取与 Json 提取标量
- ios - 在核心数据swift 4中将一个实体与另一个实体一起保存