-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Why v-model on the сustom component throw a warning without emits? #702
Comments
I'll put in a PR for this. It looks like a few of the |
There are some tweaks needed in the docs and I've got a first draft of those locally. However, there's something more going on here. Most of the documentation examples do not show a warning when run in isolation, even though they don't include I did a bit of digging and came up with this test case: https://jsfiddle.net/skirtle/yofbtL0h/ Notice this line: app.mixin({}) With that line included it shows the warning. Without that line the warning goes away. The global mixin triggers a merge operation, leading to an I need to give this some more thought but I'll probably end up reporting it as a library bug. @floydback Do you have any global mixins in your application, consistent with my theory? |
Yes! I can confirm this. Right now I've remove a plugin (it add global mixin) and this warning go away. I also tried to reproduce this warning but it didn't show up on a pure project. I could not understand what is the reason. I think your theory is right. Thank you very much. |
According to the docs this code should be enough
MyCopmponent.vue
but every time I change modelValue I got warning
[Vue warn]: Component emitted event "update:modelValue" but it is neither declared in the emits option nor as an "onUpdate:modelValue" prop. runtime-core.esm-bundler.js:156
Adding emits: ['update:modelValue'] to the component solve this, but is this behavior correct? I didn't find in the docs adding this instruction is necessary.
I use @vue/cli 4.5.8 and vue 3.0.2
The text was updated successfully, but these errors were encountered: