Преглед на файлове

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

Casper Dai преди 3 години
родител
ревизия
892d85e8f9
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  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)
                 }
               }
             }