You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
770 B
29 lines
770 B
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; |
|
|
|
}
|
|
|