diff --git a/assets/iview.png b/assets/iview.png index 3485561e..8ce27c1b 100644 Binary files a/assets/iview.png and b/assets/iview.png differ diff --git a/src/components/form/form-item.vue b/src/components/form/form-item.vue index f25bc825..226eb894 100644 --- a/src/components/form/form-item.vue +++ b/src/components/form/form-item.vue @@ -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); } } }, diff --git a/src/components/input/input.vue b/src/components/input/input.vue index 6f9caf10..5d12ffae 100644 --- a/src/components/input/input.vue +++ b/src/components/input/input.vue @@ -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; diff --git a/src/components/radio/radio-group.vue b/src/components/radio/radio-group.vue index 4f1983b5..bcf638d1 100644 --- a/src/components/radio/radio-group.vue +++ b/src/components/radio/radio-group.vue @@ -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: { diff --git a/src/components/radio/radio.vue b/src/components/radio/radio.vue index 9d964704..da481277 100644 --- a/src/components/radio/radio.vue +++ b/src/components/radio/radio.vue @@ -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; diff --git a/test/routers/form.vue b/test/routers/form.vue index 6cf219a4..7e93294d 100644 --- a/test/routers/form.vue +++ b/test/routers/form.vue @@ -1,6 +1,6 @@