Files
yudao-ui-admin-vben/apps/web-antd/src/components/upload/typing.ts

33 lines
993 B
TypeScript
Raw Normal View History

2025-05-26 18:46:06 +08:00
import type { AxiosResponse } from '@vben/request';
import type { AxiosProgressEvent } from '#/api/infra/file';
2025-04-17 23:30:34 +08:00
export enum UploadResultStatus {
DONE = 'done',
ERROR = 'error',
SUCCESS = 'success',
UPLOADING = 'uploading',
}
2025-04-24 17:56:02 +08:00
export type UploadListType = 'picture' | 'picture-card' | 'text';
2025-05-26 18:46:06 +08:00
export interface FileUploadProps {
accept?: string[]; // 根据后缀,或者其他
2025-05-26 18:46:06 +08:00
api?: (
file: File,
onUploadProgress?: AxiosProgressEvent,
) => Promise<AxiosResponse>;
directory?: string; // 上传的目录
2025-05-26 18:46:06 +08:00
disabled?: boolean;
drag?: boolean; // 是否支持拖拽上传
2025-05-26 18:46:06 +08:00
helpText?: string;
listType?: UploadListType;
maxNumber?: number; // 最大数量的文件Infinity不限制
modelValue?: string | string[]; // v-model 支持
maxSize?: number; // 文件最大多少MB
multiple?: boolean; // 是否支持多选
resultField?: string; // support xxx.xxx.xx
showDescription?: boolean; // 是否显示下面的描述
2025-05-26 18:46:06 +08:00
value?: string | string[];
}