Commit 2baba209b73ee5e30103a4a0fbb7d470398e571e
1 parent
b904fd87
update ColorPicker
Showing
2 changed files
with
7 additions
and
3 deletions
Show diff stats
examples/routers/form.vue
... | ... | @@ -5,7 +5,8 @@ |
5 | 5 | <AutoComplete v-model="formValidate.name" :data="['Li','Liang','Zhang']" placeholder="请输入姓名"></AutoComplete> |
6 | 6 | </Form-item> |
7 | 7 | <Form-item label="邮箱" prop="mail"> |
8 | - <Input v-model="formValidate.mail" placeholder="请输入邮箱"></Input> | |
8 | + <!--<Input v-model="formValidate.mail" placeholder="请输入邮箱"></Input>--> | |
9 | + <ColorPicker v-model="formValidate.mail"></ColorPicker> | |
9 | 10 | </Form-item> |
10 | 11 | <Form-item label="城市" prop="city"> |
11 | 12 | <Select v-model="formValidate.city" placeholder="请选择所在地"> |
... | ... | @@ -72,8 +73,7 @@ |
72 | 73 | { required: true, message: '姓名不能为空', trigger: 'change' } |
73 | 74 | ], |
74 | 75 | mail: [ |
75 | - { required: true, message: '邮箱不能为空', trigger: 'blur' }, | |
76 | - { type: 'email', message: '邮箱格式不正确', trigger: 'blur' } | |
76 | + { required: true, message: '邮箱不能为空', trigger: 'change' } | |
77 | 77 | ], |
78 | 78 | city: [ |
79 | 79 | { required: true, message: '请选择城市', trigger: 'change' } | ... | ... |
src/components/color-picker/color-picker.vue
... | ... | @@ -66,6 +66,7 @@ |
66 | 66 | import Alpha from './alpha.vue'; |
67 | 67 | |
68 | 68 | import { oneOf } from '../../utils/assist'; |
69 | + import Emitter from '../../mixins/emitter'; | |
69 | 70 | |
70 | 71 | const prefixCls = 'ivu-color-picker'; |
71 | 72 | const inputPrefixCls = 'ivu-input'; |
... | ... | @@ -121,6 +122,7 @@ |
121 | 122 | |
122 | 123 | export default { |
123 | 124 | name: 'ColorPicker', |
125 | + mixins: [ Emitter ], | |
124 | 126 | components: { Drop, Confirm, RecommendColors, Saturation, Hue, Alpha }, |
125 | 127 | directives: { clickoutside, TransferDom }, |
126 | 128 | props: { |
... | ... | @@ -344,11 +346,13 @@ |
344 | 346 | const color = this.formatColor; |
345 | 347 | this.$emit('input', color); |
346 | 348 | this.$emit('on-change', color); |
349 | + this.dispatch('FormItem', 'on-form-change', color); | |
347 | 350 | this.handleClose(); |
348 | 351 | }, |
349 | 352 | handleClear () { |
350 | 353 | this.$emit('input', ''); |
351 | 354 | this.$emit('on-change', ''); |
355 | + this.dispatch('FormItem', 'on-form-change', ''); | |
352 | 356 | this.handleClose(); |
353 | 357 | }, |
354 | 358 | handleSelectColor (color) { | ... | ... |