diff --git a/src/components/general/Slider.vue b/src/components/general/Slider.vue index c326b32..9c7a41f 100644 --- a/src/components/general/Slider.vue +++ b/src/components/general/Slider.vue @@ -32,21 +32,31 @@ export default { label: String, }, data() { + const num = Number(this.value); return { - sliderValue: this.value, + sliderValue: (num === num ? num : this.min), }; }, watch: { value(newVal) { - this.sliderValue = newVal; + const num = Number(newVal); + if (num === num && num !== this.sliderValue) { + this.sliderValue = num; + } }, sliderValue(newVal) { - this.$emit('input', newVal); + const num = Number(newVal); + const safe = num === num ? num : this.min; + if (this.sliderValue !== safe) { + this.sliderValue = safe; + } + this.$emit('input', safe); }, }, methods: { updateValue() { - this.$emit('input', this.sliderValue); + const num = Number(this.sliderValue); + this.$emit('input', num === num ? num : this.min); }, }, };