diff --git a/src/components/slider/slider.vue b/src/components/slider/slider.vue index 951d4ee..be9f082 100644 --- a/src/components/slider/slider.vue +++ b/src/components/slider/slider.vue @@ -291,6 +291,7 @@ if (!this.dragging) { if (this.value !== this.oldSingleValue) { this.$emit('on-change', this.value); + this.$dispatch('on-form-change', this.value); this.oldSingleValue = this.value; } } @@ -303,6 +304,7 @@ this.value = val; this.setSinglePosition(val); this.$emit('on-change', this.value); + this.$dispatch('on-form-change', this.value); }, // for range use first onFirstButtonDown (event) { @@ -345,6 +347,7 @@ if (!this.firstDragging) { if (this.value[0] !== this.oldFirstValue) { this.$emit('on-change', this.value); + this.$dispatch('on-form-change', this.value); this.oldFirstValue = this.value[0]; } } @@ -394,6 +397,7 @@ if (!this.secondDragging) { if (this.value[1] !== this.oldSecondValue) { this.$emit('on-change', this.value); + this.$dispatch('on-form-change', this.value); this.oldSecondValue = this.value[1]; } } diff --git a/test/routers/form.vue b/test/routers/form.vue index 5a97a12..c0b10b2 100644 --- a/test/routers/form.vue +++ b/test/routers/form.vue @@ -60,6 +60,9 @@ {{ item.label }} + + + 提交 @@ -104,7 +107,8 @@ group: '', checkboxgroup: [], select: '', - selectm: [] + selectm: [], + slider: [40, 50] }, rules: { mail: [ @@ -141,12 +145,17 @@ required: true } ], - selectm: [ - { - required: true, type: 'array' - }, + slider: [ { - min: 2, type: 'array' + type: 'array', len: 2, + fields: { + 0: { + type: 'number', min: 30, 'message': '不能小于30' + }, + 1: { + type: 'number', max: 90, 'message': '不能大于90' + } + } } ] } -- libgit2 0.21.4