Unverified 提交 749ba5c1 作者: SUPER_AI 提交者: GitHub

feat(table): support asynchrony in beforeFetch and afterFetch (#827)

上级 d38ff667
...@@ -203,7 +203,7 @@ export function useDataSource( ...@@ -203,7 +203,7 @@ export function useDataSource(
...(opt?.filterInfo ?? {}), ...(opt?.filterInfo ?? {}),
}; };
if (beforeFetch && isFunction(beforeFetch)) { if (beforeFetch && isFunction(beforeFetch)) {
params = beforeFetch(params) || params; params = (await beforeFetch(params)) || params;
} }
const res = await api(params); const res = await api(params);
...@@ -225,7 +225,7 @@ export function useDataSource( ...@@ -225,7 +225,7 @@ export function useDataSource(
} }
if (afterFetch && isFunction(afterFetch)) { if (afterFetch && isFunction(afterFetch)) {
resultItems = afterFetch(resultItems) || resultItems; resultItems = (await afterFetch(resultItems)) || resultItems;
} }
dataSourceRef.value = resultItems; dataSourceRef.value = resultItems;
setPagination({ setPagination({
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论