9f5e2c7e
梁灏
update Form
|
1
|
<template>
|
184dba1c
梁灏
update Form
|
2
|
<div style="width: 400px">
|
578ca325
梁灏
fixed Radio bug
|
3
|
<i-form v-ref:form :model="form" :rules="rules" :label-width="100" label-position="right">
|
184dba1c
梁灏
update Form
|
4
5
6
7
8
9
10
11
12
13
|
<form-item label="邮箱" prop="mail">
<i-input :value.sync="form.mail" placeholder="请输入邮箱">
<Icon type="ios-email-outline" slot="prepend"></Icon>
</i-input>
</form-item>
<form-item label="密码" prop="passwd">
<i-input type="password" :value.sync="form.passwd" placeholder="请输入密码">
<Icon type="ios-locked-outline" slot="prepend"></Icon>
</i-input>
</form-item>
|
578ca325
梁灏
fixed Radio bug
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
<form-item label="radio" prop="single">
<radio :checked.sync="form.single">Single</radio>
</form-item>
<form-item label="radioGroup" prop="group">
<Radio-group :model.sync="form.group">
<Radio value="apple">
<Icon type="social-apple"></Icon>
<span>Apple</span>
</Radio>
<Radio value="android">
<Icon type="social-android"></Icon>
<span>Android</span>
</Radio>
<Radio value="windows">
<Icon type="social-windows"></Icon>
<span>Windows</span>
</Radio>
</Radio-group>
</form-item>
|
f65e9be5
梁灏
update checkboxGroup
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<form-item label="checkbox-g" prop="checkboxgroup">
<Checkbox-group :model.sync="form.checkboxgroup">
<Checkbox value="twitter">
<Icon type="social-twitter"></Icon>
<span>Twitter</span>
</Checkbox>
<Checkbox value="facebook">
<Icon type="social-facebook"></Icon>
<span>Facebook</span>
</Checkbox>
<Checkbox value="github">
<Icon type="social-github"></Icon>
<span>Github</span>
</Checkbox>
<Checkbox value="snapchat">
<Icon type="social-snapchat"></Icon>
<span>Snapchat</span>
</Checkbox>
|
ba3e34e0
梁灏
update some styles
|
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
|
<Checkbox value="twitter">
<Icon type="social-twitter"></Icon>
<span>Twitter</span>
</Checkbox>
<Checkbox value="facebook">
<Icon type="social-facebook"></Icon>
<span>Facebook</span>
</Checkbox>
<Checkbox value="github">
<Icon type="social-github"></Icon>
<span>Github</span>
</Checkbox>
<Checkbox value="snapchat">
<Icon type="social-snapchat"></Icon>
<span>Snapchat</span>
</Checkbox>
<Checkbox value="twitter">
<Icon type="social-twitter"></Icon>
<span>Twitter</span>
</Checkbox>
<Checkbox value="facebook">
<Icon type="social-facebook"></Icon>
<span>Facebook</span>
</Checkbox>
<Checkbox value="github">
<Icon type="social-github"></Icon>
<span>Github</span>
</Checkbox>
<Checkbox value="snapchat">
<Icon type="social-snapchat"></Icon>
<span>Snapchat</span>
</Checkbox>
<Checkbox value="twitter">
<Icon type="social-twitter"></Icon>
<span>Twitter</span>
</Checkbox>
<Checkbox value="facebook">
<Icon type="social-facebook"></Icon>
<span>Facebook</span>
</Checkbox>
<Checkbox value="github">
<Icon type="social-github"></Icon>
<span>Github</span>
</Checkbox>
<Checkbox value="snapchat">
<Icon type="social-snapchat"></Icon>
<span>Snapchat</span>
</Checkbox>
<Checkbox value="twitter">
<Icon type="social-twitter"></Icon>
<span>Twitter</span>
</Checkbox>
<Checkbox value="facebook">
<Icon type="social-facebook"></Icon>
<span>Facebook</span>
</Checkbox>
<Checkbox value="github">
<Icon type="social-github"></Icon>
<span>Github</span>
</Checkbox>
<Checkbox value="snapchat">
<Icon type="social-snapchat"></Icon>
<span>Snapchat</span>
</Checkbox>
<Checkbox value="twitter">
<Icon type="social-twitter"></Icon>
<span>Twitter</span>
</Checkbox>
<Checkbox value="facebook">
<Icon type="social-facebook"></Icon>
<span>Facebook</span>
</Checkbox>
<Checkbox value="github">
<Icon type="social-github"></Icon>
<span>Github</span>
</Checkbox>
<Checkbox value="snapchat">
<Icon type="social-snapchat"></Icon>
<span>Snapchat</span>
</Checkbox>
|
f65e9be5
梁灏
update checkboxGroup
|
131
132
|
</Checkbox-group>
</form-item>
|
3ad47566
梁灏
update Select
|
133
134
135
136
|
<form-item label="select" prop="select">
<i-select :model.sync="form.select" style="width:200px" clearable>
<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
</i-select>
|
ba3e34e0
梁灏
update some styles
|
137
138
139
140
141
142
|
<i-select :model.sync="model11" filterable>
<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
</i-select>
<i-select :model.sync="model12" filterable multiple>
<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
</i-select>
|
3ad47566
梁灏
update Select
|
143
144
145
146
147
148
|
</form-item>
<form-item label="select多选" prop="selectm">
<i-select :model.sync="form.selectm" multiple style="width:260px">
<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
</i-select>
</form-item>
|
d1703993
梁灏
update Slider
|
149
150
151
|
<form-item label="多选滑块" prop="slider">
<Slider :value.sync="form.slider" range></Slider>
</form-item>
|
73d10c28
梁灏
update DatePicker
|
152
|
<form-item label="日期" prop="date">
|
73d10c28
梁灏
update DatePicker
|
153
154
155
|
<Time-picker :value.sync="form.date" type="time" placeholder="选择时间" style="width: 168px"></Time-picker>
</form-item>
<form-item label="两个日期" prop="date2">
|
ba3e34e0
梁灏
update some styles
|
156
|
<Date-picker :value.sync="form.date2" type="daterange" placement="bottom-start" placeholder="选择日期" @on-change="c"></Date-picker>
|
73d10c28
梁灏
update DatePicker
|
157
|
</form-item>
|
184dba1c
梁灏
update Form
|
158
159
160
|
<form-item>
<i-button type="primary" @click="onSubmit('form')">提交</i-button>
</form-item>
|
9f5e2c7e
梁灏
update Form
|
161
162
163
164
165
166
167
|
</i-form>
</div>
</template>
<script>
export default {
props: {},
data () {
|
184dba1c
梁灏
update Form
|
168
|
return {
|
3ad47566
梁灏
update Select
|
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
|
cityList: [
{
value: 'beijing',
label: '北京市'
},
{
value: 'shanghai',
label: '上海市'
},
{
value: 'shenzhen',
label: '深圳市'
},
{
value: 'hangzhou',
label: '杭州市'
},
{
value: 'nanjing',
label: '南京市'
},
{
value: 'chongqing',
label: '重庆市'
}
],
|
184dba1c
梁灏
update Form
|
195
196
|
form: {
mail: '',
|
578ca325
梁灏
fixed Radio bug
|
197
198
|
passwd: '',
single: false,
|
f65e9be5
梁灏
update checkboxGroup
|
199
|
group: '',
|
3ad47566
梁灏
update Select
|
200
201
|
checkboxgroup: [],
select: '',
|
d1703993
梁灏
update Slider
|
202
|
selectm: [],
|
73d10c28
梁灏
update DatePicker
|
203
204
205
|
slider: [40, 50],
date: '',
date2: ''
|
184dba1c
梁灏
update Form
|
206
207
208
209
|
},
rules: {
mail: [
{
|
578ca325
梁灏
fixed Radio bug
|
210
211
212
213
|
required: true, message: '请输入正确的邮箱', trigger: 'blur', type: 'email'
},
{
min: 3, max: 50, message: '长度在 3 到 50 个字符', trigger: 'blur'
|
184dba1c
梁灏
update Form
|
214
215
|
},
{
|
578ca325
梁灏
fixed Radio bug
|
216
|
min: 3, max: 50, message: '长度在 3 到 5 个字符', trigger: 'change'
|
184dba1c
梁灏
update Form
|
217
218
219
220
221
222
|
}
],
passwd: [
{
required: true, message: '请输入密码', trigger: 'blur'
}
|
578ca325
梁灏
fixed Radio bug
|
223
224
225
226
227
|
],
group: [
{
required: true, message: '请单选组'
}
|
f65e9be5
梁灏
update checkboxGroup
|
228
229
230
231
232
233
234
235
|
],
checkboxgroup: [
{
required: true, message: '至少选择2个', min: 2, type: 'array',
},
{
required: true, message: '至多选择3个', max: 3, type: 'array'
}
|
3ad47566
梁灏
update Select
|
236
237
238
239
240
241
|
],
select: [
{
required: true
}
],
|
d1703993
梁灏
update Slider
|
242
|
slider: [
|
3ad47566
梁灏
update Select
|
243
|
{
|
d1703993
梁灏
update Slider
|
244
245
246
247
248
249
250
251
252
|
type: 'array', len: 2,
fields: {
0: {
type: 'number', min: 30, 'message': '不能小于30'
},
1: {
type: 'number', max: 90, 'message': '不能大于90'
}
}
|
3ad47566
梁灏
update Select
|
253
|
}
|
73d10c28
梁灏
update DatePicker
|
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
],
date: [
{
required: true
},
{
type: 'date'
}
],
date2: [
{
type: 'array', len: 2,
fields: {
0: {
type: 'date', required: true
},
1: {
type: 'date', required: true
}
}
}
|
184dba1c
梁灏
update Form
|
275
276
277
|
]
}
}
|
9f5e2c7e
梁灏
update Form
|
278
279
|
},
computed: {},
|
184dba1c
梁灏
update Form
|
280
281
282
283
284
285
286
287
288
289
|
methods: {
onSubmit (formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$Message.success('submit!');
} else {
this.$Message.error('error submit!');
return false;
}
});
|
73d10c28
梁灏
update DatePicker
|
290
291
292
|
},
c (s) {
console.log(this.form.date)
|
184dba1c
梁灏
update Form
|
293
294
|
}
}
|
9f5e2c7e
梁灏
update Form
|
295
296
|
};
</script>
|