NightCatSama/vue-slider-component

How to control de value in two different inputs

Closed this issue · 4 comments

I'm wondering if the value is [200, 500] how can I control the values with two inputs like this:

image

Just modify the value directly.

@NightCatSama What you mean? It's two different inputs for the current min and max value, the value is [0, 0] it would be easier if it was a single value. I tried to make the model for each input to be something like v-model="value[0]" but it's not reactive.

What you said is independent of the component, the slider component only cares about whether the value passed is correct.

Directly modifying value[0] is not working, you can see the official documentation.

https://vuejs.org/v2/guide/list.html#Caveats

The easiest way is to use the splice method instead.

https://jsfiddle.net/uewf9p8j/1/

If the string passed to v-model contains a bracket, the compiler will output $set(value, 0, $event.target.value) to perform assignment

I made it to work by doing: v-model.number="value[0]"

It wasn't support to work second the docs but it does.