Closed jupelost closed 7 months ago
Slider component modelValue is like [number]
and normal input modelValue is like number
that will cause conflict between these two
Look at SliderForm
code initialValue duration is: [30]
https://www.shadcn-vue.com/docs/components/slider.html#form
But when Slider is not multiple it's weird that modelValue is still accepting [30]
not 30
hmm i wonder if there's a work around seems to be a vue thing, i did something similar in react and it works
I think it's possible that in Vue, when updating data through components, the value type of v-model will be updated to the corresponding data format.In your code, when type="number", the format of modelValue is number; when type="range", the format is string. However, this is different from the format of modelValue for Slider, which is an array of numbers.
i ended up figuring it out using computed as an intermediary between the two. The computed property handled the conversion between the array value and the single number value.
Reproduction
https://stackblitz.com/edit/9wnv28?file=src%2FApp.vue
Describe the bug
When using vmodel to bind slider to a ref and binding it to another input as well weird issue happens where the value of the slider doesnt change to get updated i tried the emit prop for on change but i cant seem to get it working
https://github.com/radix-vue/shadcn-vue/assets/94334900/5aed2336-29b0-4185-a1a7-f4299320317f
System Info
Contributes