feat(hooks): 优化表格响应数据处理

This commit is contained in:
xlsea
2025-12-07 18:12:54 +08:00
parent 47e8a7b07f
commit 7d7f28c4cf
3 changed files with 2 additions and 8 deletions
-1
View File
@@ -6,7 +6,6 @@ import useLoading from './use-loading';
export interface PaginationData<T> {
data: T[];
pageNum: number;
pageSize: number;
total: number;
}
+1 -6
View File
@@ -131,9 +131,6 @@ export function useNaivePaginatedTable<ResponseData, ApiData>(
getColumns,
onFetched: data => {
pagination.itemCount = data.total;
if (data.pageSize) {
pagination.pageSize = data.pageSize;
}
}
});
@@ -249,17 +246,15 @@ export function defaultTransform<ApiData>(
return {
data: [],
pageNum: 1,
pageSize: 10,
total: 0
};
}
const { rows: records, pageSize: size, pageNum: current, total } = data;
const { rows: records, pageNum: current, total } = data;
return {
data: records,
pageNum: current,
pageSize: size,
total
};
}
+1 -1
View File
@@ -10,7 +10,7 @@ declare namespace Api {
/** current page number */
pageNum: number;
/** page size */
pageSize: number;
pageSize?: number;
/** total count */
total: number;
}