You've already forked DataMate
fix(data): 修复分页总数获取逻辑
- 修改 useFetchData 钩子中的分页总数计算方式 - 添加对 data?.total 的备选值支持 - 使用空值合并运算符替代逻辑或运算符提高健壮性
This commit is contained in:
@@ -132,7 +132,7 @@ export default function useFetchData<T>(
|
|||||||
|
|
||||||
setPagination((prev) => ({
|
setPagination((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
total: data?.totalElements || 0,
|
total: data?.totalElements ?? data?.total ?? 0,
|
||||||
}));
|
}));
|
||||||
let result = [];
|
let result = [];
|
||||||
if (mapDataFunc) {
|
if (mapDataFunc) {
|
||||||
|
|||||||
Reference in New Issue
Block a user