Skip to content

Commit

Permalink
[优化] 优化分页组件,避免在切换单页记录数时可能发生的异常
Browse files Browse the repository at this point in the history
  • Loading branch information
rdkmaster authored Nov 11, 2021
1 parent b2a4ee3 commit c3c995e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/jigsaw/pc-components/pagination/pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<jigsaw-select *ngIf="pageSizeOptions && pageSizeOptions.length > 0"
[value]="_$pageSize"
(valueChange)="_changePageSize($event)"
(valueChange)="_$changePageSize($event)"
[trackItemBy]="['value','label']"
labelField="label"
width="80"
Expand Down Expand Up @@ -60,7 +60,7 @@
<jigsaw-select *ngIf="pageSizeOptions && pageSizeOptions.length > 0"
class="jigsaw-paging-page-size"
[value]="_$pageSize"
(valueChange)="_changePageSize($event)"
(valueChange)="_$changePageSize($event)"
[trackItemBy]="['value','label']"
labelField="label"
width="80"
Expand Down
10 changes: 7 additions & 3 deletions src/jigsaw/pc-components/pagination/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,13 @@ export class JigsawPagination extends AbstractJigsawComponent implements OnInit,
* @internal
* select组件改变pageSize
* */
public _changePageSize(pageSize) {
if (this.pageSize != pageSize.value) {
this.pageSize = pageSize.value;
public _$changePageSize(pageSize: {value?: number}): void {
const value = pageSize?.value;
if (isNaN(value)) {
return;
}
if (this.pageSize != value) {
this.pageSize = value;
this.current = 1;
}
this._changeDetectorRef.markForCheck();
Expand Down

0 comments on commit c3c995e

Please sign in to comment.