style: scroll to field

This commit is contained in:
jialin
2025-10-21 19:59:49 +08:00
parent 1e4018350f
commit fc7350b7e2
6 changed files with 166 additions and 34 deletions
+7
View File
@@ -129,6 +129,12 @@ export default function useTableFetch<T>(
..._.pickBy(query || queryParams, (val: any) => !!val)
};
const res = await fetchAPI(params);
if (!dataSource.loadend) {
// add a delay to avoid flash
await new Promise((resolve) => {
setTimeout(resolve, 200);
});
}
if (
!res.items.length &&
params.page > res.pagination.totalPage &&
@@ -139,6 +145,7 @@ export default function useTableFetch<T>(
page: res.pagination.totalPage
};
const newRes = await fetchAPI(newParams);
setDataSource({
dataList: loadmore
? [...dataSource.dataList, ...(newRes.items || [])]