import { AllowedComponentProps, VNodeProps } from '../common' // 上传文件状态 declare type UploadFileStatus = 'pending' | 'uploading' | 'done' | 'error' // 上传文件接口 declare interface UploadFile { uid: string name: string size: number type?: string url?: string thumbUrl?: string status: 'pending' | 'uploading' | 'done' | 'error' progress?: number response?: any error?: Error rawFile?: any file?: Object } // 上传组件 Props declare interface UploadProps { // 值 modelValue?: string | UploadFile[] // 上传类型 type?: 'button' | 'card' | 'avatar' | 'drag' | undefined // 按钮配置 buttonText?: string buttonType?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' // 'primary' | 'default' | 'warning' | 'error' buttonSize?: 'small' | 'medium' | 'large' // 卡片配置 cardText?: string // 头像配置 avatarText?: string avatarSize?: number | string avatarRadius?: string showAvatarCamera?: boolean avatarCameraColor?: string // 拖拽配置 dragText?: string // 通用配置 hint?: string tip?: string showTip?: boolean showActions?: boolean showUploadAll?: boolean showClear?: boolean // 文件配置 accept?: string // 比如:image/*,.pdf,.doc,.docx multiple?: boolean maxCount?: number maxSize?: number // 单位:字节 beforeUpload?: (file: Object) => boolean | Promise // 上传前钩子 // 上传配置 action?: string accessToken?: string, headers?: Record data?: Record name?: string withCredentials?: boolean timeout?: number autoUpload?: boolean // 响应格式化 responseFormatter?: (response: any) => { url: string;[key: string]: any } // 列表配置 showList?: boolean listType?: 'text' | 'picture' removable?: boolean previewable?: boolean // 状态 disabled?: boolean readonly?: boolean // 自定义上传 customRequest?: (file: Object, onProgress: (percent: number) => void) => Promise } // 上传组件方法 declare interface UploadMethods { // 清空文件列表 clearFiles: () => void // 取消指定上传 abortUpload: (uid: string) => void // 上传所有文件 uploadAll: () => Promise // 获取文件列表 getFiles: () => UploadFile[] } declare interface UploadEmits { (e: 'update:modelValue', files: string | UploadFile[]): void (e: 'change', files: string | UploadFile[]): void (e: 'select', file: Object): void (e: 'success', file: UploadFile): void (e: 'error', error: Error, file: UploadFile): void (e: 'progress', percent: number, file: UploadFile): void (e: 'remove', file: UploadFile, index: number): void (e: 'preview', file: UploadFile): void (e: 'exceed', files: Object[]): void (e: 'uploading', file: UploadFile): void (e: 'uploaded', file: UploadFile): void } declare interface _Upload { new(): { $props: AllowedComponentProps & VNodeProps & UploadProps $emit: UploadEmits } & UploadMethods } export declare const Upload: _Upload export default Upload export type { UploadFileStatus, UploadFile, UploadProps, UploadMethods, UploadEmits }