[Bug Report] v-select onchange event returns previously selected value instead of current
See original GitHub issueVersions 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
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 😉
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