SUPER_AI
2021-06-29 749ba5c1daf459625518937c239787b756c0a780
feat(table): support asynchrony in beforeFetch and afterFetch (#827)

1个文件已修改
4 ■■■■ 已修改文件
src/components/Table/src/hooks/useDataSource.ts 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/Table/src/hooks/useDataSource.ts
@@ -203,7 +203,7 @@
        ...(opt?.filterInfo ?? {}),
      };
      if (beforeFetch && isFunction(beforeFetch)) {
        params = beforeFetch(params) || params;
        params = (await beforeFetch(params)) || params;
      }
      const res = await api(params);
@@ -225,7 +225,7 @@
      }
      if (afterFetch && isFunction(afterFetch)) {
        resultItems = afterFetch(resultItems) || resultItems;
        resultItems = (await afterFetch(resultItems)) || resultItems;
      }
      dataSourceRef.value = resultItems;
      setPagination({