Commit 929141be968721e87eb032c2719bdc34afa40d44
Committed by
GitHub
1 parent
e82bafa4
fix:fetch-success total 0 (#1597)
Co-authored-by: qiuxiang <liumeiwang@localhost.com>
Showing
1 changed file
with
1 additions
and
1 deletions
src/components/Table/src/hooks/useDataSource.ts
@@ -292,7 +292,7 @@ export function useDataSource( | @@ -292,7 +292,7 @@ export function useDataSource( | ||
292 | const isArrayResult = Array.isArray(res); | 292 | const isArrayResult = Array.isArray(res); |
293 | 293 | ||
294 | let resultItems: Recordable[] = isArrayResult ? res : get(res, listField); | 294 | let resultItems: Recordable[] = isArrayResult ? res : get(res, listField); |
295 | - const resultTotal: number = isArrayResult ? 0 : get(res, totalField); | 295 | + const resultTotal: number = isArrayResult ? res.length : get(res, totalField); |
296 | 296 | ||
297 | // 假如数据变少,导致总页数变少并小于当前选中页码,通过getPaginationRef获取到的页码是不正确的,需获取正确的页码再次执行 | 297 | // 假如数据变少,导致总页数变少并小于当前选中页码,通过getPaginationRef获取到的页码是不正确的,需获取正确的页码再次执行 |
298 | if (resultTotal) { | 298 | if (resultTotal) { |