好吧,没有开箱即用的水平滚动条,但选项卡的集合可以是一个变量。所以在这种情况下你可以实现一些简单的分页。就像是
import { Component } from '@angular/core';
@Component({
selector: 'app-list',
templateUrl: './list.component.html'
})
export class ListComponent {
public allTabs = [
{ name: '1111', content: ' content 1 '},
{ name: '2222', content: ' content 2 '}
{ name: '3333', content: ' content 3 '}
{ name: '4444', content: ' content 4 '}
{ name: '5555', content: ' content 5 '}
];
public totalPages = 0;
public currentTabs = this.allTabs.slice(0, 2);
public pageSize: number = 2;
public currentPage = 1;
public nextPage() {
this.currentPage++;
this.currentTabs = this.allTabs.slice((this.currentPage - 1) * this.pageSize, (this.currentPage) * this.pageSize);
}
public prevPage() {
this.currentPage--;
this.currentTabs = this.allTabs.slice((this.currentPage - 1) * this.pageSize, (this.currentPage) * this.pageSize);
}
constructor (){
this.totalPages = Math.round(this.allTabs.length / this.pageSize);
}
}
和模板
<kendo-tabstrip [ngStyle]="{'width': '400px'}">
<kendo-tabstrip-tab
*ngFor="let item of currentTabs; let i=index"
[title]="item.name"
[selected]="i === 0"
>
<ng-template kendoTabContent>
{{ item.content }}
</ng-template>
</kendo-tabstrip-tab>
</kendo-tabstrip>
<button type="button" (click)="prevPage()" [disabled]="currentPage === 1">Prev</button>
<button type="button" (click)="nextPage()" [disabled]="currentPage === totalPages">Next</button>
有点假的卷轴:)