Ver Fonte

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

Casper Dai há 3 anos atrás
pai
commit
892d85e8f9
1 ficheiros alterados com 2 adições e 2 exclusões
  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)
                 }
               }
             }