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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
| import { generateUUID } from '@/utils'
| import { localeProps, makeRequiredRule } from '@/components/FormCreate/src/utils'
|
| export const useUploadImgRule = () => {
| const label = '单图上传'
| const name = 'UploadImg'
| return {
| icon: 'icon-upload',
| label,
| name,
| rule() {
| return {
| type: name,
| field: generateUUID(),
| title: label,
| info: '',
| $required: false
| }
| },
| props(_, { t }) {
| return localeProps(t, name + '.props', [
| makeRequiredRule(),
| {
| type: 'switch',
| field: 'drag',
| title: '拖拽上传',
| value: false
| },
| {
| type: 'select',
| field: 'fileType',
| title: '图片类型限制',
| value: ['image/jpeg', 'image/png', 'image/gif'],
| options: [
| { label: 'image/apng', value: 'image/apng' },
| { label: 'image/bmp', value: 'image/bmp' },
| { label: 'image/gif', value: 'image/gif' },
| { label: 'image/jpeg', value: 'image/jpeg' },
| { label: 'image/pjpeg', value: 'image/pjpeg' },
| { label: 'image/svg+xml', value: 'image/svg+xml' },
| { label: 'image/tiff', value: 'image/tiff' },
| { label: 'image/webp', value: 'image/webp' },
| { label: 'image/x-icon', value: 'image/x-icon' }
| ],
| props: {
| multiple: true
| }
| },
| {
| type: 'inputNumber',
| field: 'fileSize',
| title: '大小限制(MB)',
| value: 5,
| props: { min: 0 }
| },
| {
| type: 'input',
| field: 'height',
| title: '组件高度',
| value: '150px'
| },
| {
| type: 'input',
| field: 'width',
| title: '组件宽度',
| value: '150px'
| },
| {
| type: 'input',
| field: 'borderradius',
| title: '组件边框圆角',
| value: '8px'
| },
| {
| type: 'switch',
| field: 'disabled',
| title: '是否显示删除按钮',
| value: true
| },
| {
| type: 'switch',
| field: 'showBtnText',
| title: '是否显示按钮文字',
| value: true
| }
| ])
| }
| }
| }
|
|