update ColorPicker

This commit is contained in:
梁灏 2017-08-23 16:06:30 +08:00
parent b904fd871d
commit 2baba209b7
2 changed files with 7 additions and 3 deletions

View file

@ -5,7 +5,8 @@
<AutoComplete v-model="formValidate.name" :data="['Li','Liang','Zhang']" placeholder="请输入姓名"></AutoComplete> <AutoComplete v-model="formValidate.name" :data="['Li','Liang','Zhang']" placeholder="请输入姓名"></AutoComplete>
</Form-item> </Form-item>
<Form-item label="邮箱" prop="mail"> <Form-item label="邮箱" prop="mail">
<Input v-model="formValidate.mail" placeholder="请输入邮箱"></Input> <!--<Input v-model="formValidate.mail" placeholder="请输入邮箱"></Input>-->
<ColorPicker v-model="formValidate.mail"></ColorPicker>
</Form-item> </Form-item>
<Form-item label="城市" prop="city"> <Form-item label="城市" prop="city">
<Select v-model="formValidate.city" placeholder="请选择所在地"> <Select v-model="formValidate.city" placeholder="请选择所在地">
@ -72,8 +73,7 @@
{ required: true, message: '姓名不能为空', trigger: 'change' } { required: true, message: '姓名不能为空', trigger: 'change' }
], ],
mail: [ mail: [
{ required: true, message: '邮箱不能为空', trigger: 'blur' }, { required: true, message: '邮箱不能为空', trigger: 'change' }
{ type: 'email', message: '邮箱格式不正确', trigger: 'blur' }
], ],
city: [ city: [
{ required: true, message: '请选择城市', trigger: 'change' } { required: true, message: '请选择城市', trigger: 'change' }

View file

@ -66,6 +66,7 @@
import Alpha from './alpha.vue'; import Alpha from './alpha.vue';
import { oneOf } from '../../utils/assist'; import { oneOf } from '../../utils/assist';
import Emitter from '../../mixins/emitter';
const prefixCls = 'ivu-color-picker'; const prefixCls = 'ivu-color-picker';
const inputPrefixCls = 'ivu-input'; const inputPrefixCls = 'ivu-input';
@ -121,6 +122,7 @@
export default { export default {
name: 'ColorPicker', name: 'ColorPicker',
mixins: [ Emitter ],
components: { Drop, Confirm, RecommendColors, Saturation, Hue, Alpha }, components: { Drop, Confirm, RecommendColors, Saturation, Hue, Alpha },
directives: { clickoutside, TransferDom }, directives: { clickoutside, TransferDom },
props: { props: {
@ -344,11 +346,13 @@
const color = this.formatColor; const color = this.formatColor;
this.$emit('input', color); this.$emit('input', color);
this.$emit('on-change', color); this.$emit('on-change', color);
this.dispatch('FormItem', 'on-form-change', color);
this.handleClose(); this.handleClose();
}, },
handleClear () { handleClear () {
this.$emit('input', ''); this.$emit('input', '');
this.$emit('on-change', ''); this.$emit('on-change', '');
this.dispatch('FormItem', 'on-form-change', '');
this.handleClose(); this.handleClose();
}, },
handleSelectColor (color) { handleSelectColor (color) {