example.data.ts
8.9 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
import { FormSchema } from '/@/components/Form';
import dayjs from 'dayjs';
export const schemas: FormSchema[] = [
{
label: '文本框',
field: 'name',
component: 'Input',
componentProps: {
prefix: '中文',
showCount: true,
},
defaultValue: '张三',
},
{
label: '密码',
field: 'password',
component: 'InputPassword',
componentProps: {
//是否显示切换按钮或者控制密码显隐
visibilityToggle: true,
prefix: '密码',
},
},
{
label: '搜索框',
field: 'searchBox',
component: 'InputSearch',
componentProps: {
onSearch: (value) => {
console.log(value);
},
},
},
{
label: '文本域',
field: 'textArea',
component: 'InputTextArea',
componentProps: {
//可以点击清除图标删除内容
allowClear: true,
//是否展示字数
showCount: true,
//自适应内容高度,可设置为 true | false 或对象:{ minRows: 2, maxRows: 6 }
autoSize: {
//最小显示行数
minRows: 2,
//最大显示行数
maxRows: 3,
},
},
},
{
label: '数值输入框',
field: 'number',
component: 'InputNumber',
componentProps: {
//带标签的 input,设置后置标签
addonAfter: '保留两位小数',
//最大值
max: 100,
//数值经度
precision: 2,
//步数
step: 0.1,
},
},
{
label: '下拉框',
field: 'jinputtype',
component: 'Select',
componentProps: {
options: [
{ value: 'like', label: '模糊(like)' },
{ value: 'ne', label: '不等于(ne)' },
{ value: 'ge', label: '大于等于(ge)' },
{ value: 'le', label: '小于等于(le)' },
],
//下拉多选
mode: 'multiple',
//配置是否可搜索
showSearch: true,
},
},
{
field: 'TreeSelect',
label: '下拉树',
component: 'TreeSelect',
componentProps: {
//是否显示下拉框,默认false
treeCheckable: true,
//标题
title: '下拉树',
//下拉树
treeData: [
{
label: '洗衣机',
value: '0',
children: [
{
label: '滚筒洗衣机',
value: '0-1',
},
],
},
{
label: '电视机',
value: '1',
children: [
{
label: '平板电视',
value: '1-1',
disabled: true,
},
{
label: 'CRT电视机',
value: '1-2',
},
{
label: '投影电视',
value: '1-3',
},
],
},
],
},
},
{
label: 'RadioButtonGroup组件',
field: 'status',
component: 'RadioButtonGroup',
componentProps: {
options: [
{ label: '有效', value: 1 },
{ label: '无效', value: 0 },
],
},
},
{
label: '单选框',
field: 'radioSex',
component: 'RadioGroup',
componentProps: {
//options里面由一个一个的radio组成,支持disabled禁用
options: [
{ label: '男', value: 1, disabled: false },
{ label: '女', value: 0 },
],
},
},
{
label: '多选框',
field: 'checkbox',
component: 'Checkbox',
componentProps: {
//是否禁用,默认false
disabled: false,
},
},
{
label: '多选框组',
field: 'checkSex',
component: 'CheckboxGroup',
componentProps: {
//RadioGroup 下所有 input[type="radio"] 的 name 属性
name: '爱好',
//options支持disabled禁用
options: [
{ label: '运动', value: 0, disabled: true },
{ label: '听音乐', value: 1 },
{ label: '看书', value: 2 },
],
},
defaultValue: [2],
},
{
label: '自动完成组件',
field: 'AutoComplete',
component: 'AutoComplete',
componentProps: {
options: [{ value: 'Burns Bay Road' }, { value: 'Downing Street' }, { value: 'Wall Street' }],
},
},
{
label: '级联选择',
field: 'cascade',
component: 'Cascader',
componentProps: {
//最多显示多少个tag
maxTagCount: 2,
//浮层预设位置
placement: 'bottomRight',
//在选择框中显示搜索框,默认false
showSearch: true,
options: [
{
label: '北京',
value: 'BeiJin',
children: [
{
label: '海淀区',
value: 'HaiDian',
},
],
},
{
label: '江苏省',
value: 'JiangSu',
children: [
{
label: '南京',
value: 'Nanjing',
children: [
{
label: '中华门',
value: 'ZhongHuaMen',
},
],
},
],
},
],
},
},
{
label: '日期选择',
field: 'dateSelect',
component: 'DatePicker',
componentProps: {
//日期格式化,页面上显示的值
format: 'YYYY-MM-DD',
//返回值格式化(绑定值的格式)
valueFormat: 'YYYY-MM-DD',
//是否显示今天按钮
showToday: true,
//不可选择日期
disabledDate: (currentDate) => {
let date = dayjs(currentDate).format('YYYY-MM-DD');
let nowDate = dayjs(new Date()).format('YYYY-MM-DD');
//当天不可选择
if (date == nowDate) {
return true;
}
return false;
},
},
},
{
label: '月份选择',
field: 'monthSelect',
component: 'MonthPicker',
componentProps: {
//不可选择日期
disabledDate: (currentDate) => {
let date = dayjs(currentDate).format('YYYY-MM');
let nowDate = dayjs(new Date()).format('YYYY-MM');
//当天不可选择
if (date == nowDate) {
return true;
}
return false;
},
},
},
{
label: '周选择',
field: 'weekSelect',
component: 'WeekPicker',
componentProps: {
size: 'small',
},
},
{
label: '时间选择',
field: 'timeSelect',
component: 'TimePicker',
componentProps: {
size: 'default',
//日期时间或者时间模式下是否显示此刻,不支持日期时间范围和时间范围
showNow: true,
},
},
{
label: '日期时间范围',
field: 'dateTimeRangeSelect',
component: 'RangePicker',
componentProps: {
//是否显示时间
showTime: true,
//日期格式化
format: 'YYYY/MM/DD HH:mm:ss',
//范围文本描述用集合
placeholder: ['请选择开始日期时间', '请选择结束日期时间'],
},
},
{
label: '日期范围',
field: 'dateRangeSelect',
component: 'RangeDate',
componentProps: {
//日期格式化
format: 'YYYY/MM/DD',
//范围文本描述用集合
placeholder: ['请选择开始日期', '请选择结束日期'],
},
},
{
label: '时间范围',
field: 'timeRangeSelect',
component: 'RangeTime',
componentProps: {
//日期格式化
format: 'HH/mm/ss',
//范围文本描述用集合
placeholder: ['请选择开始时间', '请选择结束时间'],
},
},
{
label: '开关',
field: 'switch',
component: 'Switch',
componentProps: {
//开关大小,可选值:default small
size: 'default',
//非选中时的内容
unCheckedChildren: '开启',
//非选中时的值
unCheckedValue: '0',
//选中时的内容
checkedChildren: '关闭',
//选中时的值
checkedValue: '1',
//是否禁用
disabled: false,
},
},
{
label: '滑动输入条',
field: 'slider',
component: 'Slider',
componentProps: {
//最小值
min: -20,
//最大值
max: 100,
//是否为双滑块模式
range: true,
//刻度标记
marks: {
'-20': '-20°C',
0: '0°C',
26: '26°C',
37: '37°C',
100: {
style: {
color: '#f50',
},
label: '100°C',
},
},
},
},
{
label: '评分',
field: 'rate',
component: 'Rate',
componentProps: {
//是否允许半选
allowHalf: true,
//star 总数
count: 5,
//tooltip提示,有几颗星写几个
tooltips: ['非常差', '较差', '正常', '很好', '非很好'],
},
},
{
label: '分割线',
field: 'divisionLine',
component: 'Divider',
componentProps: {
//是否虚线
dashed: false,
//分割线标题的位置(left | right | center)
orientation: 'center',
//文字是否显示为普通正文样式
plain: true,
//水平还是垂直类型(horizontal | vertical)
type: 'horizontal',
},
},
];