update Slider

update Slider
This commit is contained in:
梁灏 2017-01-04 11:56:27 +08:00
parent 3ad47566a4
commit d170399368
2 changed files with 19 additions and 6 deletions

View file

@ -291,6 +291,7 @@
if (!this.dragging) { if (!this.dragging) {
if (this.value !== this.oldSingleValue) { if (this.value !== this.oldSingleValue) {
this.$emit('on-change', this.value); this.$emit('on-change', this.value);
this.$dispatch('on-form-change', this.value);
this.oldSingleValue = this.value; this.oldSingleValue = this.value;
} }
} }
@ -303,6 +304,7 @@
this.value = val; this.value = val;
this.setSinglePosition(val); this.setSinglePosition(val);
this.$emit('on-change', this.value); this.$emit('on-change', this.value);
this.$dispatch('on-form-change', this.value);
}, },
// for range use first // for range use first
onFirstButtonDown (event) { onFirstButtonDown (event) {
@ -345,6 +347,7 @@
if (!this.firstDragging) { if (!this.firstDragging) {
if (this.value[0] !== this.oldFirstValue) { if (this.value[0] !== this.oldFirstValue) {
this.$emit('on-change', this.value); this.$emit('on-change', this.value);
this.$dispatch('on-form-change', this.value);
this.oldFirstValue = this.value[0]; this.oldFirstValue = this.value[0];
} }
} }
@ -394,6 +397,7 @@
if (!this.secondDragging) { if (!this.secondDragging) {
if (this.value[1] !== this.oldSecondValue) { if (this.value[1] !== this.oldSecondValue) {
this.$emit('on-change', this.value); this.$emit('on-change', this.value);
this.$dispatch('on-form-change', this.value);
this.oldSecondValue = this.value[1]; this.oldSecondValue = this.value[1];
} }
} }

View file

@ -60,6 +60,9 @@
<i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option> <i-option v-for="item in cityList" :value="item.value">{{ item.label }}</i-option>
</i-select> </i-select>
</form-item> </form-item>
<form-item label="多选滑块" prop="slider">
<Slider :value.sync="form.slider" range></Slider>
</form-item>
<form-item> <form-item>
<i-button type="primary" @click="onSubmit('form')">提交</i-button> <i-button type="primary" @click="onSubmit('form')">提交</i-button>
</form-item> </form-item>
@ -104,7 +107,8 @@
group: '', group: '',
checkboxgroup: [], checkboxgroup: [],
select: '', select: '',
selectm: [] selectm: [],
slider: [40, 50]
}, },
rules: { rules: {
mail: [ mail: [
@ -141,12 +145,17 @@
required: true required: true
} }
], ],
selectm: [ slider: [
{ {
required: true, type: 'array' type: 'array', len: 2,
}, fields: {
{ 0: {
min: 2, type: 'array' type: 'number', min: 30, 'message': '不能小于30'
},
1: {
type: 'number', max: 90, 'message': '不能大于90'
}
}
} }
] ]
} }