Commit 2e3ecd93 authored by 杨奕's avatar 杨奕 Committed by FuryBean

Slider: fix a NaN value bug (#1286)

parent f729497d
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
this.$nextTick(() => { this.$nextTick(() => {
this.updatePopper(); this.updatePopper();
}); });
if (val < this.min) { if (typeof val !== 'number' || isNaN(val) || val < this.min) {
this.$emit('input', this.min); this.$emit('input', this.min);
return; return;
} }
...@@ -221,7 +221,9 @@ ...@@ -221,7 +221,9 @@
}, },
created() { created() {
if (typeof this.value !== 'number' || this.value < this.min) { if (typeof this.value !== 'number' ||
isNaN(this.value) ||
this.value < this.min) {
this.$emit('input', this.min); this.$emit('input', this.min);
} else if (this.value > this.max) { } else if (this.value > this.max) {
this.$emit('input', this.max); this.$emit('input', this.max);
......
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