Skip to content Skip to sidebar Skip to footer

Vuetify V-select Onchange Event Returns Previously Selected Value Instead Of Current

I have a dropdown that I'm wanting to use as a list of URLs to navigate to other pages. The issue I'm running into is the onchangeevent I'm using returns the previ

Solution 1:

You don't need to specify the data because that's what, I'm guessing, the change event passes by default.

So change:

v-on:change="changeRoute(`${select.src}`)"

to just

v-on:change="changeRoute"

and in the function call:

  changeRoute(a) {
    this.$router.push({path: a.src })
    console.log(a)
  }

Solution 2:


Solution 3:

I don't exctly know why ${select.src} is holding previous value on change event. You can give a try with below code:

<v-select @change="changeRoute" ></v-select>

methods: {
      changeRoute(selectObj) {
        console.log(selectObj)
        console.log(selectObj.src)
     }
}

Post a Comment for "Vuetify V-select Onchange Event Returns Previously Selected Value Instead Of Current"