|
5 | 5 | <span class="ctrlName">{{name}}</span> |
6 | 6 | </div> |
7 | 7 | <div class="slider-container"> |
8 | | - <input type="number" :value="displayMin" v-on:change="setMin"/> |
| 8 | + <input :value="displayMin" :placeholder="displayMin" v-on:change="setMin"/> |
9 | 9 | <!-- <vue-slider v-model="value" :min="min" :max="max" :interval="interval" /> --> |
10 | 10 | <vue-slider v-model="value" :data="data" :adsorb="true" @change="putVal"/> |
11 | | - <input type="number" :value="displayMax" v-on:change="setMax" /> |
| 11 | + <input :value="displayMax" :placeholder="displayMax" v-on:change="setMax" /> |
12 | 12 | </div> |
13 | 13 | </div> |
14 | 14 | </template> |
@@ -66,14 +66,20 @@ export default { |
66 | 66 | putVal(keys.join('.'), value); |
67 | 67 | }, |
68 | 68 | setMin: function (e) { |
69 | | - this.min = parseMath(e.target.value); |
70 | | - this.data = Array.from(Array(101), (_, i) => this.min + (this.max-this.min) / 100 * i); |
71 | | - this.value = this.findNearest(this.data, this.value); |
| 69 | + let min = parseMath(e.target.value); |
| 70 | + if (min < this.max) { |
| 71 | + this.min = min; |
| 72 | + this.data = Array.from(Array(101), (_, i) => this.min + (this.max-this.min) / 100 * i); |
| 73 | + this.value = this.findNearest(this.data, this.value); |
| 74 | + } |
72 | 75 | }, |
73 | 76 | setMax: function (e) { |
74 | | - this.max = parseMath(e.target.value); |
75 | | - this.data = Array.from(Array(101), (_, i) => this.min + (this.max-this.min) / 100 * i); |
76 | | - this.value = this.findNearest(this.data, this.value); |
| 77 | + let max = parseMath(e.target.value); |
| 78 | + if (max > this.min) { |
| 79 | + this.max = max; |
| 80 | + this.data = Array.from(Array(101), (_, i) => this.min + (this.max-this.min) / 100 * i); |
| 81 | + this.value = this.findNearest(this.data, this.value); |
| 82 | + } |
77 | 83 | }, |
78 | 84 | deleteCtrl: function() { |
79 | 85 | // commit a mutation in the store with the relevant information |
|
0 commit comments