Use the @Emit decorator to automatically emit Vue component events when a method is called.
By default, the emitted event name is the kebab-case version of the method name. If you provide a string argument to @Emit(eventName), that specific name will be used instead.
Behavioral Rules:
- Event Naming: If no event name is provided, the method name is hyphenated (e.g.,
myMethod becomes my-method). - Arguments:
- If the method returns
undefined and has no arguments, it emits the event without payload. - If the method returns
undefined and has arguments, it emits the event with those arguments. - If the method returns a value, that value is automatically prepended to the arguments list sent to
$emit.
- Async Support: If the decorated method returns a
Promise, the event will be emitted only after the promise resolves, using the resolved value as the event payload.