New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$defineModels not working as expected #292
Labels
bug
Something isn't working
Comments
|
According to docs
|
sxzz
changed the title
$defineModel not working as expected
$defineModels not working as expected
Apr 4, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
After discovering this as an alternative for the deprecated Vue3 Reactivity Transforms, I had a read through the docs and saw this really cool defineModel macro, which could vastly simplify passing around some reactive state.
However, the version mentioned here does not allow me to use the resulting variable as a v-model in the template, because there it only counts as a non-writable prop, resulting in the following error:
"[plugin:vite:vue] v-model cannot be used on a prop, because local prop bindings are not writable.
Use a v-bind binding combined with a v-on listener that emits update:x event instead."
This is less of a bug and more a natural result of how the feature is implemented, however the way it limits its use is certainly unintended. I invite further discussion in the matter and apologize if my issue has been poorly expressed, since it has been a while since I've used Vue at all.
Btw, the output of envinfo seems to be wrong - Firefox (110.0) is my main browser after all.
Reproduction
https://github.com/adroslice/vue-macros-definemodel-repro/tree/main/client
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: