question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug Report] v-select onchange event returns previously selected value instead of current

See original GitHub issue

Versions and Environment

Vuetify: 1.4.1 Last working version: 1.4.0 Vue: 2.5.21 Browsers: Chromium 71.0.3578.80 OS: Ubuntu undefined

Steps to reproduce

<template>
<v-select
      v-model="value"
      :items="items"
      @change="printValue()"
    ></v-select>
</template>

<script>
  export default {
    data: () => ({
      value: null,
      items: ['Foo', 'Bar', 'Fizz', 'Buzz']
    }),
    methods: {
      printValue() {
        console.log(this.value);
      }
    }
  }
</script>

Expected Behavior

When I selected Foo, it should console.log ‘Foo’, And When I selected Bar, it should console.log ‘Bar’.

Actual Behavior

When I selected Foo, it actually console.log ‘null’, And When I selected Bar, it actually console.log ‘Foo’.

Reproduction Link

https://codesandbox.io/s/m4n65nxvmx

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
mascit13commented, Jan 14, 2019

Ah! We also made this mistake of accessing the binded property in change function. Here is a sandbox that shows the different values. nextTick() can help, but i think better way is to use the functions parameter. https://codesandbox.io/s/vvjr2nylj0 thank KaelWD 😉

1reaction
CarstenRueckercommented, Jan 25, 2019

Just just stumbled upon this change in behaviour in 1.4 too. I fail to see why a variable bound to a v-model should be updated after the change event is fired, because that’s exactly the thing that changed. Best regards from layer 8 😛

https://codepen.io/logic7/pen/gqPwPB?editors=1111

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Vuetify v-select onchange event returns previously ...
The issue I'm running into is the onchange event I'm using returns the previously selected value instead of the current selected value. I...
Read more >
[Solved]-Vuetify v-select onchange event returns previously ...
Coding example for the question Vuetify v-select onchange event returns previously selected value instead of current-Vue.js.
Read more >
onchange event does not fire for select element when using ...
After first entering the bug, I learned that when you use the keyboard to change the selected option, if the dropdown loses focus...
Read more >
Form Select | Components - BootstrapVue
Custom component using cross-browser custom styles. Optionally generate entries based on an array, array of objects.
Read more >
Select | Quasar Framework
In case you are looking for a dropdown “button” instead of “input” use Button ... Fills the input with current value; Useful along...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found