未验证 提交 749ba5c1 编写于 作者: S 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 is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册