fix(Range): progress style (#385)

This commit is contained in:
HylaruCoder
2023-07-05 02:03:12 +08:00
committed by GitHub
parent cd2b671075
commit a79c165eee

View File

@@ -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}%`
}
})