refactor(hooks): 优化 useImportFile 类型定义

- 移除自定义 UploadFile 接口,改用 antd 库中的 UploadFile 类型
- 删除未使用的 ImportFileOptions 接口定义
- 简化类型定义,提升代码维护性
- 更新 README,移除重复的 UploadFile 类型说明
2.0
LiuJiaNan 2026-07-03 15:07:36 +08:00
parent 95f22d7064
commit 2ffa8bed34
2 changed files with 1 additions and 12 deletions

View File

@ -1419,8 +1419,6 @@ useImportFile("object"): { loading: boolean; importFile: ImportFileFunction }
| `options.files` | `UploadFile[]` | 是 | `[]` | 上传文件数组。 | | `options.files` | `UploadFile[]` | 是 | `[]` | 上传文件数组。 |
| `options.params` | `Record<string, any>` | 否 | `{}` | 额外提交参数。 | | `options.params` | `Record<string, any>` | 否 | `{}` | 额外提交参数。 |
`UploadFile``originFileObj?: File`,并支持业务扩展字段。
### useDownloadFile ### useDownloadFile
引入: 引入:

View File

@ -1,8 +1,4 @@
export interface UploadFile { import type { UploadFile } from "antd/es/upload";
/** 原始文件对象 */
originFileObj?: File;
[key: string]: any;
}
interface UseImportFileOptions { interface UseImportFileOptions {
/** 要上传的文件数组 */ /** 要上传的文件数组 */
@ -11,11 +7,6 @@ interface UseImportFileOptions {
params?: Record<string, any>; params?: Record<string, any>;
} }
export interface ImportFileOptions {
url: string;
options: UseImportFileOptions;
}
export type ImportFileFunction = (url: string, options: UseImportFileOptions) => Promise<any>; export type ImportFileFunction = (url: string, options: UseImportFileOptions) => Promise<any>;
/** /**