Browse Source

refactor(table): switch to the last page when there is no data for the specified number of pages

Casper Dai 3 năm trước cách đây
mục cha
commit
892d85e8f9
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      src/components/table/mixins/table.js

+ 2 - 2
src/components/table/mixins/table.js

@@ -131,9 +131,9 @@ export default {
             data = transform ? data.map(transform) : data
             if (this.needPagination) {
               if (data.length === 0) {
-                const { pageNum } = options.params
+                const { pageNum, pageSize } = options.params
                 if (pageNum > 1) {
-                  return this.pageTo(1)
+                  return this.pageTo(totalCount ? Math.ceil(totalCount / pageSize) : 1)
                 }
               }
             }