瀏覽代碼

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)
                 }
               }
             }