gpt4 book ai didi

html - 如何使用angular2在分页中用左右箭头替换上一个和下一个

转载 作者:太空宇宙 更新时间:2023-11-04 01:30:34 25 4
gpt4 key购买 nike

我有一个分页,我得到上一个和下一个。谁能帮我用左右箭头替换它

HTML:

<pagination-controls (pageChange)="page = $event" id="1" maxSize="10" directionLinks="true" autoHide="true" class="page">
</pagination-controls>

CSS:

.left {
display: inline-block;
width: 4em;
height: 4em;
margin-right: 1.5em;
}

.left:after {
content: '';
display: inline-block;
margin-top: 1.05em;
margin-left: 0.6em;
width: 1.4em;
height: 1.4em;
border-top: 0.5em solid #333;
border-right: 0.5em solid #333;
-moz-transform: rotate(-135deg);
-webkit-transform: rotate(-135deg);
transform: rotate(-135deg);
}

.right {
display: inline-block;
width: 4em;
height: 4em;
margin-left: 1.5em;
}

.right:after {
content: '';
display: inline-block;
margin-top: 1.05em;
margin-left: -0.6em;
width: 1.4em;
height: 1.4em;
border-top: 0.5em solid #333;
border-right: 0.5em solid #333;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}

这是左右箭头的 css,我怎么用 html 写这个,我的意思是如何链接?

最佳答案

您使用的分页插件是完全可定制的

您甚至可以创建完全自定义的模板。

这是我创建的示例,

组件,

export class AppComponent {
collection = [];
constructor() {
for (let i = 1; i <= 100; i++) {
this.collection.push(`item ${i}`);
}
}
public config: PaginationInstance = {
id: 'custom',
itemsPerPage: 10,
currentPage: 1,
directionLinks: false
};
}

自定义 HTML,

<div class="container-fluid">
<div class="row">
<div class="medium-8 medium-offset-2 columns">
<h2 class="subheader"></h2>
<ul>
<li *ngFor="let item of collection | paginate: config">{{ item }}</li>
</ul>
</div>
</div>
<div class="row">
<pagination-template #p="paginationApi"
[id]="config.id"
(pageChange)="config.currentPage = $event">
<div class="custom-pagination">
<div class="pagination-previous" [class.disabled]="p.isFirstPage()">
<a *ngIf="!p.isFirstPage()" (click)="p.previous()"> < </a>
</div>
<div *ngFor="let page of p.pages" [class.current]="p.getCurrent() === page.value">
<a (click)="p.setCurrent(page.value)" *ngIf="p.getCurrent() !== page.value">
<span>{{ page.label }}</span>
</a>
<div *ngIf="p.getCurrent() === page.value">
<span>{{ page.label }}</span>
</div>
</div>
<div class="pagination-next" [class.disabled]="p.isLastPage()">
<a *ngIf="!p.isLastPage()" (click)="p.next()"> > </a>
</div>
</div>
</pagination-template>
</div>
</div>

Here is their official custom template document

A WORKING DEMO

附言:

您甚至可以添加您的 css 代码并根据需要对其进行自定义

关于html - 如何使用angular2在分页中用左右箭头替换上一个和下一个,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47179091/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com