Replacement of "emit" method in Vue
P粉668019339
P粉668019339 2024-03-19 18:10:36
0
1
360

When I use "emit", Vue complains that I'm looking for a functionally equivalent alternative

This will be a to-do list

Code:

Warning in browser console:

runtime-core.esm-bundler.js?5c40:38 [Vue warn]: An unrelated non-emitted event listener (deleteTodoEvent) was passed to the component but cannot be automatically inherited because the component renders a fragment or text root node . If the listener is to be used only as a component custom event listener, declare it using the "emis" option. at > at

P粉668019339
P粉668019339

reply all(1)
P粉178132828

You appear to be using Vue 3. The warning tells you that the event is not declared before it is used in the component. Here is an example:

export default {
  name: "YourComponent",
  emits: ["deleteTodoEvent"], // 
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template