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.

v-model don't get updated before on-change method execute

See original GitHub issue

I’m submitting a … (check one with “x”)

[X] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[ ] Other, please describe

Tell about your platform

  • flatPickr version : 4.2.4
  • Vue.js version : 2.5.8
  • Browser name and version : Chrome 63.0.3239.132 (Official Build) (64-bit)
  • This package version : 6.2.0

Current behavior I want to emit event with value bound to v-model in method that execute @on-change event, but problem is that emitted value is previous one (null on first change).

Expected behavior Emitted value should be one that has just been selected.

Minimal reproduction of the problem with instructions Example is in codesandbox link, code is in /components/Hello.vue. You can see how value changes in console (I am a bit old school, so console.log).

https://codesandbox.io/s/6l44rkvpvw

Any help or advice what is wrong or what am I doing wrong so this happens would be very appreciated!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ankurk91commented, Jun 26, 2020

@Glideh

Move your input1, input2, input3 to a parent object and add a deep watcher to it.

form : {
            input1: null,
            input2: null,
            input3: null,
        }
mounted(){

this.$watch('form', this.updateStore, {deep:true})
}
1reaction
andrijavuliceviccommented, Feb 8, 2018

Thank you very much! I didn’t realised this works that way

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fire an event when v-model changes? - Stack Overflow
I want to add that when using keyDown, the model only seems to update after the event fires. When using input, it seems...
Read more >
Select element with v-model and v-on="change:onChange ...
Hi, I noticed that in FF onChange event is triggered before v-model variable is updated. In all other browsers variable is updated first....
Read more >
Vue-Multiselect | Vue Select Library
custom-label accepts a function with the option object as the first param. It should return a string which is then used to display...
Read more >
Documentation - SolidJS · Reactive Javascript Library
Solid's overall approach to reactivity is to wrap any reactive computation in a function, and rerun that function when its dependencies update.
Read more >
Adding a new todo form: Vue events, methods, and models
Binding data to inputs with v-model · Add a data() method to our ToDoForm component object that returns a label field. We can...
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