Skip to content

Commit 1281075

Browse files
zcg1991rdkmaster
authored andcommitted
[修复] 分页下一页按钮的bug问题
1 parent a548a20 commit 1281075

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/jigsaw/component/pagination/pagination.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ export class JigsawPagination extends AbstractJigsawComponent implements OnInit,
7070
}
7171

7272
public set data(value: IPageable) {
73-
if(CommonUtils.isUndefined(value) || !(value.pagingInfo instanceof PagingInfo)) return;
73+
if (CommonUtils.isUndefined(value) || !(value.pagingInfo instanceof PagingInfo)) return;
7474
this._data = value;
75-
if(typeof this._data.onRefresh == 'function') {
75+
if (typeof this._data.onRefresh == 'function') {
7676
this._data.onRefresh(() => {
7777
this._renderPages();
7878
});
@@ -122,7 +122,7 @@ export class JigsawPagination extends AbstractJigsawComponent implements OnInit,
122122
if (this.current != newValue) {
123123
this._current = newValue;
124124
this.currentChange.emit(newValue);
125-
if(this.data.pagingInfo.currentPage != newValue) {
125+
if (this.data.pagingInfo.currentPage != newValue) {
126126
// pagingInfo.currentPage采用的getter&setter,不可随便赋值
127127
this.data.pagingInfo.currentPage = newValue;
128128
}
@@ -142,7 +142,7 @@ export class JigsawPagination extends AbstractJigsawComponent implements OnInit,
142142
this._$pageSize.value = newValue;
143143
this._$pageSize.label = newValue + '/' + this._translateService.instant('pagination.page');
144144
this.pageSizeChange.emit(newValue);
145-
if(this.data.pagingInfo.pageSize != newValue) {
145+
if (this.data.pagingInfo.pageSize != newValue) {
146146
// pagingInfo.pageSize采用的getter&setter,不可随便赋值
147147
this.data.pagingInfo.pageSize = newValue;
148148
}
@@ -202,7 +202,8 @@ export class JigsawPagination extends AbstractJigsawComponent implements OnInit,
202202
* @internal
203203
*/
204204
public _$pagePrev(): void {
205-
if(this.mode == 'simple') {
205+
if (this.mode == 'simple') {
206+
if (this.current == 1) return;
206207
this.current--;
207208
} else {
208209
let pageCur = this._pages.find(page => page.current == true);
@@ -221,7 +222,8 @@ export class JigsawPagination extends AbstractJigsawComponent implements OnInit,
221222
* @internal
222223
*/
223224
public _$pageNext(): void {
224-
if(this.mode == 'simple') {
225+
if (this.mode == 'simple') {
226+
if (this.current == this._totalPage) return;
225227
this.current++;
226228
} else {
227229
let pageCur = this._pages.find(page => page.current == true);
@@ -318,7 +320,7 @@ export class JigsawPagination extends AbstractJigsawComponent implements OnInit,
318320
private _goto(pageNum): void {
319321
pageNum = parseInt(pageNum);
320322
if (pageNum <= this._totalPage && pageNum >= 1) {
321-
if(this.mode != 'simple') {
323+
if (this.mode != 'simple') {
322324
this._pages.find(page => page.current == true).cancelCurrent();
323325
this._pages.find(page => page.pageNumber == pageNum).setCurrent();
324326
}
@@ -340,7 +342,7 @@ export class JigsawPagination extends AbstractJigsawComponent implements OnInit,
340342
* 渲染page按钮
341343
* */
342344
private _renderPages(): void {
343-
if(!this.data || !this.data.pagingInfo) return;
345+
if (!this.data || !this.data.pagingInfo) return;
344346

345347
this.current = this.data.pagingInfo.currentPage;
346348
this._totalRecord = this.data.pagingInfo.totalRecord;
@@ -373,8 +375,8 @@ export class JigsawPagination extends AbstractJigsawComponent implements OnInit,
373375
* 刷新数据时清空搜索框
374376
*/
375377
public reset() {
376-
if(!this.inputs) return;
377-
this.inputs.forEach(input => input.value='');
378+
if (!this.inputs) return;
379+
this.inputs.forEach(input => input.value = '');
378380
}
379381

380382
ngOnInit() {

0 commit comments

Comments
 (0)