Commit 48054d12 authored by pengchongfu's avatar pengchongfu Committed by 杨奕

Slider: triggers validator when value changed, fixed #3968

parent d0be75a4
...@@ -46,10 +46,13 @@ ...@@ -46,10 +46,13 @@
import ElInputNumber from 'element-ui/packages/input-number'; import ElInputNumber from 'element-ui/packages/input-number';
import SliderButton from './button.vue'; import SliderButton from './button.vue';
import { getStyle } from 'element-ui/src/utils/dom'; import { getStyle } from 'element-ui/src/utils/dom';
import Emitter from 'element-ui/src/mixins/emitter';
export default { export default {
name: 'ElSlider', name: 'ElSlider',
mixins: [Emitter],
props: { props: {
min: { min: {
type: Number, type: Number,
...@@ -173,6 +176,7 @@ ...@@ -173,6 +176,7 @@
this.secondValue = val[1]; this.secondValue = val[1];
if (this.valueChanged()) { if (this.valueChanged()) {
this.$emit('change', [this.minValue, this.maxValue]); this.$emit('change', [this.minValue, this.maxValue]);
this.dispatch('ElFormItem', 'el.form.change', [this.minValue, this.maxValue]);
this.oldValue = val.slice(); this.oldValue = val.slice();
} }
} }
...@@ -185,6 +189,7 @@ ...@@ -185,6 +189,7 @@
this.firstValue = val; this.firstValue = val;
if (this.valueChanged()) { if (this.valueChanged()) {
this.$emit('change', val); this.$emit('change', val);
this.dispatch('ElFormItem', 'el.form.change', val);
this.oldValue = val; this.oldValue = val;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment