Can you please help me with creating a double range slider (I only need two handles) for the native HTML input=range and Vue.js?
My code so far: https://jsfiddle.net/
Javascript (Vue.js)
var vm = new Vue({
el: '#app',
data: {
minAngle: 10,
maxAngle: 30
},
computed: {
sliderMin: {
get: function() {
var val = this.minAngle;
return val;
},
set: function(val) {
if (val > this.maxAngle) {
val = this.maxAngle;
}
this.minAngle = val;
console.log("minAngle:" + this.minAngle + " maxAngle:" + this.maxAngle);
}
},
sliderMax: {
get: function() {
var val = this.maxAngle;
return val;
},
set: function(val) {
if (val < this.minAngle) {
val = this.minAngle;
}
this.maxAngle = val;
console.log("minAngle:" + this.minAngle + " maxAngle:" + this.maxAngle);
}
}
}
});
HTML
<div id="app">
<input type="range" min="0" max="180" step="1" v-model="sliderMin">
<input type="number" min="0" max="180" step="1" v-model="sliderMin">
<input type="range" min="0" max="180" step="1" v-model="sliderMax">
<input type="number" min="0" max="180" step="1" v-model="sliderMax">
</div>
The problem is that I would like to limit the range of the minSlider and the maxSlider if their values come below the min. So you would not get the maxAngle be below the minAngle or minAngle be above the maxAngle. Later I will of course make one slider on the top of each other using CSS so you will get the illusion it is only one slider with two handles. I know that there are Vue components for this but I was wondering if this is possible.
Thanks in advance, Bogdan