Vue-slider-component: TypeError: Cannot read property 'value' of undefined

Created on 5 Oct 2018  路  1Comment  路  Source: NightCatSama/vue-slider-component

Hello,
I'd like to make a range slider

<vue-slider ref="slider" v-bind="heightRange" v-model="heightRange.value"></vue-slider>
In the data I have defined heightRange as follows:

heightRange: {
        value: [
        150,
        200
        ],
        width: "100%",
        height: 8,
        //etc
      },

But whenever I move one of the knobs, I get this:

TypeError: Cannot read property 'value' of undefined

How can I fix this?

Most helpful comment

AFAIK, 'value' in options is used for initial setup, but not for changeable variable. So, move your model variable outside of options object, like this:

<vue-slider ref="slider" v-bind="heightRange" v-model="currentValue"></vue-slider>
//data: {
currentValue: [150,200], //this will be changing during process
heightRange: {
    value: [150,200], //this is initial value
    width: "100%",
    height: 8 //, 
    //etc
}
//}

>All comments

AFAIK, 'value' in options is used for initial setup, but not for changeable variable. So, move your model variable outside of options object, like this:

<vue-slider ref="slider" v-bind="heightRange" v-model="currentValue"></vue-slider>
//data: {
currentValue: [150,200], //this will be changing during process
heightRange: {
    value: [150,200], //this is initial value
    width: "100%",
    height: 8 //, 
    //etc
}
//}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

isaacjoy picture isaacjoy  路  4Comments

exodusanto picture exodusanto  路  6Comments

creativejeff picture creativejeff  路  7Comments

ThomasPoncet picture ThomasPoncet  路  5Comments

ericdrobinson picture ericdrobinson  路  4Comments