4 小时以前 b8f3dc696c6907da579bc281e0682a0236c2e8d9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import type { AxiosResponse } from '@vben/request';
 
import type { AxiosProgressEvent } from '#/api/infra/file';
 
export enum UploadResultStatus {
  DONE = 'done',
  ERROR = 'error',
  SUCCESS = 'success',
  UPLOADING = 'uploading',
}
 
export type UploadListType = 'picture' | 'picture-card' | 'text';
 
export interface FileUploadProps {
  accept?: string[]; // 根据后缀,或者其他
  api?: (
    file: File,
    onUploadProgress?: AxiosProgressEvent,
  ) => Promise<AxiosResponse>;
  directory?: string; // 上传的目录
  disabled?: boolean;
  drag?: boolean; // 是否支持拖拽上传
  helpText?: string;
  listType?: UploadListType;
  maxNumber?: number; // 最大数量的文件,Infinity不限制
  modelValue?: string | string[] | number[]; // v-model 支持
  maxSize?: number; // 文件最大多少MB
  multiple?: boolean; // 是否支持多选
  resultField?: string; // support xxx.xxx.xx
  returnText?: boolean; // 是否返回文件文本内容
  showDescription?: boolean; // 是否显示下面的描述
  showDownloadIcon?: boolean; // 是否显示下载按钮
  value?: string | string[] | number[];
  valueKey?: string; // 返回值的字段名,默认 'url',设为 'id' 时返回 blobId
  valuePrefix?: string; // valueKey 返回值的前缀
}