Blame view

src/components/Upload/src/props.ts 1.45 KB
jq authored
1
import type { PropType } from 'vue';
2
import { FileBasicColumn } from './typing';
jq authored
3
4
5
6
7
8
9
10
11
12
13

export const basicProps = {
  helpText: {
    type: String as PropType<string>,
    default: '',
  },
  // 文件最大多少MB
  maxSize: {
    type: Number as PropType<number>,
    default: 2,
  },
14
  // 最大数量的文件,Infinity不限制
jq authored
15
16
  maxNumber: {
    type: Number as PropType<number>,
17
    default: Infinity,
jq authored
18
19
20
21
22
23
24
  },
  // 根据后缀,或者其他
  accept: {
    type: Array as PropType<string[]>,
    default: () => [],
  },
  multiple: {
25
    type: Boolean as PropType<boolean>,
jq authored
26
27
    default: true,
  },
28
29
30
31
32
33
34
35
36
  uploadParams: {
    type: Object as PropType<any>,
    default: {},
  },
  api: {
    type: Function as PropType<PromiseFn>,
    default: null,
    required: true,
  },
jq authored
37
38
39
40
41
42
43
44
};

export const uploadContainerProps = {
  value: {
    type: Array as PropType<string[]>,
    default: () => [],
  },
  ...basicProps,
45
46
47
48
49
50
51
52
  showPreviewNumber: {
    type: Boolean as PropType<boolean>,
    default: true,
  },
  emptyHidePreview: {
    type: Boolean as PropType<boolean>,
    default: false,
  },
jq authored
53
54
};
55
export const previewProps = {
jq authored
56
57
58
59
60
  value: {
    type: Array as PropType<string[]>,
    default: () => [],
  },
};
jq authored
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

export const fileListProps = {
  columns: {
    type: [Array] as PropType<FileBasicColumn[]>,
    default: null,
  },
  actionColumn: {
    type: Object as PropType<FileBasicColumn>,
    default: null,
  },
  dataSource: {
    type: Array as PropType<any[]>,
    default: null,
  },
};