From a79c165eeeb3e8ea76cd3abc1b8f1218d02b446b Mon Sep 17 00:00:00 2001 From: HylaruCoder Date: Wed, 5 Jul 2023 02:03:12 +0800 Subject: [PATCH] fix(Range): progress style (#385) --- src/runtime/components/forms/Range.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runtime/components/forms/Range.vue b/src/runtime/components/forms/Range.vue index d43f2202..85df3e84 100644 --- a/src/runtime/components/forms/Range.vue +++ b/src/runtime/components/forms/Range.vue @@ -128,8 +128,11 @@ export default defineComponent({ }) const progressStyle = computed(() => { + const { modelValue, min, max } = props + const clampedValue = Math.max(min, Math.min(modelValue, max)) + const relativeValue = (clampedValue - min) / (max - min) return { - width: `${(props.modelValue / props.max) * 100}%` + width: `${relativeValue * 100}%` } })