Commit 62a06f5679f915d959c8a4b32d2da144ad22fd88

Authored by 梁灏
1 parent 8dd54687

fixed #724

examples/routers/slider.vue
1 1 <template>
2 2 <div style="margin: 0 400px;">
3   - <Slider v-model="value1" show-input></Slider>
4   - <Slider v-model="value2" range></Slider>
5   - <Slider v-model="value3" range disabled></Slider>
6   - {{ value1 }}{{value2}}
7   - <div @click="value1 = 13">change value1</div>
8   - <br>
9   - <Slider v-model="value9" :tip-format="format"></Slider>
10   - <Slider v-model="value10" :tip-format="hideFormat"></Slider>
  3 + <Slider v-model="value" range></Slider>
  4 + <Button @click="change">change</Button>
11 5 </div>
12 6 </template>
13 7 <script>
14 8 export default {
15 9 data () {
16 10 return {
17   - value1: 25,
18   - value2: [20, 50],
19   - value3: [20, 50],
20   - value9: 25,
21   - value10: 25
  11 + value: [20, 50]
22 12 }
23 13 },
24 14 methods: {
25   - format (val) {
26   - return '进度' + val + '%';
27   - },
28   - hideFormat () {
29   - return null;
  15 + change () {
  16 + this.value = [30, 80];
30 17 }
31 18 }
32 19 }
... ...
src/components/slider/slider.vue
... ... @@ -230,7 +230,11 @@
230 230 if (value[1] > this.max) {
231 231 value[1] = this.max;
232 232 }
233   - if (this.value[0] === value[0] && this.value[1] === value[1]) return;
  233 + if (this.value[0] === value[0] && this.value[1] === value[1]) {
  234 + this.setFirstPosition(this.currentValue[0]);
  235 + this.setSecondPosition(this.currentValue[1]);
  236 + return;
  237 + }
234 238  
235 239 this.currentValue = value;
236 240 this.setFirstPosition(this.currentValue[0]);
... ...