Commit 2a632f04 authored by Leopoldthecoder's avatar Leopoldthecoder Committed by 杨奕

Slider: fix incorrect initial value when min>0 and showInput is true

parent 32f848fd
<template> <template>
<div class="el-slider"> <div class="el-slider">
<el-input-number <el-input-number
v-model="inputValue" v-model="firstValue"
v-if="showInput && !range" v-if="showInput && !range"
class="el-slider__input" class="el-slider__input"
ref="input" ref="input"
...@@ -100,16 +100,11 @@ ...@@ -100,16 +100,11 @@
secondValue: null, secondValue: null,
oldValue: null, oldValue: null,
precision: 0, precision: 0,
inputValue: null,
dragging: false dragging: false
}; };
}, },
watch: { watch: {
inputValue(val) {
this.firstValue = val;
},
value(val, oldVal) { value(val, oldVal) {
if (this.dragging || if (this.dragging ||
Array.isArray(val) && Array.isArray(val) &&
...@@ -130,7 +125,6 @@ ...@@ -130,7 +125,6 @@
if (this.range) { if (this.range) {
this.$emit('input', [this.minValue, this.maxValue]); this.$emit('input', [this.minValue, this.maxValue]);
} else { } else {
this.inputValue = val;
this.$emit('input', val); this.$emit('input', val);
} }
}, },
...@@ -281,7 +275,6 @@ ...@@ -281,7 +275,6 @@
return decimal ? decimal.length : 0; return decimal ? decimal.length : 0;
}); });
this.precision = Math.max.apply(null, precisions); this.precision = Math.max.apply(null, precisions);
this.inputValue = this.inputValue || this.firstValue;
} }
}; };
</script> </script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment