diff --git a/packages/x-components/src/components/base-slider.vue b/packages/x-components/src/components/base-slider.vue index 51c6e195e..bb11dea3a 100644 --- a/packages/x-components/src/components/base-slider.vue +++ b/packages/x-components/src/components/base-slider.vue @@ -80,6 +80,20 @@ } ); + watch([() => props.modelValue.min, () => props.modelValue.max], ([min, max]) => { + if (min === minSelected.value && max === maxSelected.value) { + return; + } + + const minValidated = min < props.threshold.min ? props.threshold.min : min; + const maxValidated = max > props.threshold.max ? props.threshold.max : max; + sliderInstance.set([minValidated, maxValidated]); + + if (minValidated !== min || maxValidated !== max) { + emit('update:modelValue', { min: minValidated, max: maxValidated }); + } + }); + return { slider, rangeSelected