Select doesn't always get updated model value when using @update:modelValue or @update:model-value #3778
Unanswered
Bond-Addict
asked this question in
Q&A
Replies: 1 comment 8 replies
-
I think you mustn't use both v-model and @update:modelValue. If you want do something when value is updated, you need smth like this:
|
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the sandbox it works correctly.
https://codesandbox.io/p/sandbox/nice-darwin-iqjx2m
But my local code isn't working. It works on every other component but this new one is having an issues.
@update:modelValue
or@update:model-value
calls my function, but the reactive property doesn't show any value until you change the selection a second time and it then show the value as the previously selected option.watch
only seems to get hit if I'm also using one of the methods for hooking into the update event.I've testing using a reactive or even a ref.
Bellow is psudocode of my compoent.
P.S. I've tried using a reactive prop on a different component and it works exactly how its supposed to. I can get it to work correctly if I pass $event to setValue or if I use the watch with a getter function. I tested using a html select and then using v-on:change to call my function which works exactly as expected. Is there something obvious I'm doing wrong? It seems as straight forward as the rest of the times I've used it on other components.
Beta Was this translation helpful? Give feedback.
All reactions