fixed Radio bug

fixed Radio bug
This commit is contained in:
梁灏 2017-01-04 11:03:22 +08:00
parent 184dba1c8e
commit 578ca32537
6 changed files with 42 additions and 7 deletions

View file

@ -219,9 +219,8 @@
return false;
}
});
// todo
// this.$on('el.form.blur', this.onFieldBlur);
// this.$on('el.form.change', this.onFieldChange);
this.$on('on-form-blur', this.onFieldBlur);
this.$on('on-form-change', this.onFieldChange);
}
}
},

View file

@ -140,9 +140,11 @@
},
handleBlur () {
this.$emit('on-blur');
this.$dispatch('on-form-blur', this.value);
},
handleChange (event) {
this.$emit('on-change', event);
this.$dispatch('on-form-change', this.value);
},
resizeTextarea () {
const autosize = this.autosize;

View file

@ -9,6 +9,7 @@
const prefixCls = 'ivu-radio-group';
export default {
name: 'radioGroup',
props: {
model: {
type: [String, Number],
@ -51,6 +52,7 @@
this.model = data.value;
this.updateModel();
this.$emit('on-change', data.value);
this.$dispatch('on-form-change', data.value);
}
},
watch: {

View file

@ -62,6 +62,7 @@
}
},
ready () {
if (this.$parent && this.$parent.$options.name === 'radioGroup') this.group = true;
if (!this.group) {
this.updateModel();
}
@ -81,6 +82,8 @@
checked: this.checked
});
}
if (!this.group) this.$dispatch('on-form-change', this.selected);
},
updateModel () {
this.selected = this.checked;