邵佳豪
2 years ago
6 changed files with 37312 additions and 43313 deletions
@ -1,29 +0,0 @@
|
||||
import { MatPaginatorIntl } from '@angular/material/paginator'; |
||||
|
||||
|
||||
const dutchRangeLabel = (page: number, pageSize: number, length: number) => { |
||||
if (length === 0 || pageSize === 0) { return `0 到 ${length}`; } |
||||
length = Math.max(length, 0); |
||||
const startIndex = page * pageSize; |
||||
const endIndex = startIndex < length ? |
||||
Math.min(startIndex + pageSize, length) : |
||||
startIndex + pageSize; |
||||
return `${startIndex + 1} - ${endIndex} / ${length}条`; |
||||
|
||||
} |
||||
|
||||
export function myPaginator() { |
||||
|
||||
const paginatorIntl = new MatPaginatorIntl(); |
||||
|
||||
paginatorIntl.itemsPerPageLabel = '每页条数:'; |
||||
|
||||
paginatorIntl.nextPageLabel = '下一页:'; |
||||
|
||||
paginatorIntl.previousPageLabel = '上一页:'; |
||||
|
||||
paginatorIntl.getRangeLabel = dutchRangeLabel; |
||||
|
||||
return paginatorIntl; |
||||
|
||||
} |
@ -1,13 +0,0 @@
|
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
import { MatPaginatorIntl, MatPaginatorModule } from '@angular/material/paginator'; |
||||
import { myPaginator } from './my-paginator' |
||||
|
||||
@NgModule({ |
||||
imports: [ |
||||
CommonModule, |
||||
MatPaginatorModule |
||||
], |
||||
providers: [ { provide: MatPaginatorIntl, useValue: myPaginator() } ] |
||||
}) |
||||
export class PaginatorModule { } |
Loading…
Reference in new issue