Commit 9090cee18485ec9a2714ba04605fd211b52eb18d

Authored by 李勇
Committed by GitHub
1 parent 31042de6

fix: table-datasource,如果后端返回的page total是字符串,会导致页码乱掉 (#2483)

src/components/Table/src/hooks/useDataSource.ts
... ... @@ -310,7 +310,7 @@ export function useDataSource(
310 310 const resultTotal: number = isArrayResult ? res.length : get(res, totalField);
311 311  
312 312 // 假如数据变少,导致总页数变少并小于当前选中页码,通过getPaginationRef获取到的页码是不正确的,需获取正确的页码再次执行
313   - if (resultTotal) {
  313 + if (Number(resultTotal)) {
314 314 const currentTotalPage = Math.ceil(resultTotal / pageSize);
315 315 if (current > currentTotalPage) {
316 316 setPagination({
... ...