26 lines
684 B
TypeScript
26 lines
684 B
TypeScript
export interface UploadFile {
|
|
/** 原始文件对象 */
|
|
originFileObj?: File;
|
|
[key: string]: any;
|
|
}
|
|
|
|
interface UseImportFileOptions {
|
|
/** 要上传的文件数组 */
|
|
files: UploadFile[];
|
|
/** 额外携带的参数对象 */
|
|
params?: Record<string, any>;
|
|
}
|
|
|
|
export interface ImportFileOptions {
|
|
url: string;
|
|
options: UseImportFileOptions;
|
|
}
|
|
|
|
export type ImportFileFunction = (url: string, options: UseImportFileOptions) => Promise<any>;
|
|
|
|
/**
|
|
* 导入文件
|
|
*/
|
|
export default function useImportFile(returnType: "array"): [boolean, ImportFileFunction];
|
|
export default function useImportFile(returnType?: "object"): { loading: boolean; importFile: ImportFileFunction };
|