UNPKG

@opensig/opendesign

Version:

<p align="center"><img src="../docs/public/opendesign-logo-light.png"/></p> <h1 align="center">opendesign</h1> <p align="center">一个 Vue 3 组件库</p> <p align="center"><b>皮肤可定制,使用 TypeScript</b></p>

136 lines (135 loc) 3.27 kB
import { ExtractPropTypes, PropType } from 'vue'; export interface UploadRequestT { abort: () => void; } export declare const UploadFileStatusTypes: readonly ["pending", "uploading", "finished", "failed"]; export type UploadFileStatusT = (typeof UploadFileStatusTypes)[number]; export interface UploadFileT { id: string; name: string; file?: File; status?: UploadFileStatusT; message?: string; messageClass?: string; retry?: boolean; percent?: number; request?: UploadRequestT; icon?: any; imgUrl?: any; } export interface UploadRequestOptionT { onProgress: (percent: number, event?: ProgressEvent) => void; onSuccess: (response?: any) => void; onError: (response?: any, retry?: boolean) => void; file: UploadFileT; } export declare const UploadListTypes: readonly ["text", "picture", "picture-card"]; export type UploadListTypeT = (typeof UploadListTypes)[number]; export declare const uploadProps: { /** * 文件列表(受控) * v-model */ modelValue: { type: PropType<UploadFileT[]>; }; /** * 文件列表(非受控) */ defaultFileList: { type: PropType<UploadFileT[]>; }; /** * 文件选择 MIME类型 * image/jpeg;image/jpg;image/png;image/gif;video/mp4; */ accept: { type: StringConstructor; }; /** * 是否为禁用状态 */ disabled: { type: BooleanConstructor; }; /** * 是否支持多选 */ multiple: { type: BooleanConstructor; }; /** * 选择文件前回调,根据返回值判断是否继续选择文件 */ beforeSelect: { type: PropType<(value: UploadFileT[]) => Promise<boolean> | boolean>; }; /** * 选择后触发 */ onAfterSelect: { type: PropType<(fileList: FileList) => Promise<Array<UploadFileT>>>; }; /** * 选择按钮文本 */ btnLabel: { type: StringConstructor; }; /** * 自定义上传请求 */ uploadRequest: { type: PropType<(options: UploadRequestOptionT) => UploadRequestT>; }; /** * true 选择完成后,手动触发上传;false 选择完成后自动上传 */ lazyUpload: { type: BooleanConstructor; }; /** * 上传前触发 */ onBeforeUpload: { type: PropType<(file: UploadFileT) => Promise<boolean | File>>; }; /** * 删除前触发 */ onBeforeRemove: { type: PropType<(file: UploadFileT) => Promise<boolean>>; }; /** * 支持拖拽上传 */ draggable: { type: BooleanConstructor; }; /** * 拖拽区域上传提示文本 */ dragLabel: { type: StringConstructor; }; /** * 拖拽区域拖拽中的提示文本 */ dragHoverLabel: { type: StringConstructor; }; /** * 文件列表类型 */ listType: { type: PropType<"text" | "picture" | "picture-card">; default: string; }; /** * 生成缩略图 */ createThumbnail: { type: PropType<(file: File) => Promise<string>>; }; }; export type UploadPropsT = ExtractPropTypes<typeof uploadProps>;