Skip to content

Commit

Permalink
feat: listens for changes in model value
Browse files Browse the repository at this point in the history
  • Loading branch information
victorcg88 committed Oct 28, 2024
1 parent c31b772 commit 47d27ce
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/x-components/src/components/base-slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 47d27ce

Please sign in to comment.