Vue Warn: Component emitted event customEvent but it is neither declared in the emits option...
See original GitHub issueI saw issue 197, and the apparent fix. But I am getting this warning message still.
My set up is fairly simple:
- Parent component is shallow mounted.
- Child component is found via
wrapper.findComponent. - Child component performs a
childComponent.vm.$emit('customEvent')
And, the actual child component does have the custom event in the emits option.
Within the test, I tried setting the global.config.warnMessage’s option to simply return if the message arg included the warning, but that didn’t work. I also tried childComponent.vm.$options.emits = ['customEvent'] but it did not work either.
Any ideas?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Vue Warn: Component emitted event customEvent but it is ...
Vue Warn : Component emitted event customEvent but it is neither ... event "continue" but it is neither declared in the emits option...
Read more >Component emitted event but it is neither ... - Vue Forum
[Vue warn]: Component emitted event "angle" but it is neither declared in the emits option nor as an "onAngle" prop.
Read more >vuejs 3: declare an emit event in a child component via emits ...
If the listener is intended to be a component custom event listener only, declare it using the "emits" option. I understand the "emits"...
Read more >component emitted event but it is neither ... - Syncfusion
Hello,. I am using NumericTextBox and DropdownList Component in Vue3. It works fine but I keep seeing warning in the browser console window....
Read more >A Guide to Vue $emit - How to Emit Custom Events in Vue
Defining your custom events using emits If we're not using defineEmits , we can still keep track custom events for a component by...
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 Free
Top 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
This error occurred to me as well. It happened when I changed the emit definition, but the page was only hot updated. After a complete reload, everything was fine. Therefore, it’s not related to this repo IMO, but maybe helpful for someone else getting a similar error.
Factory simply
shallowMountsthe component.