Skip to content

Warning when emitting kebab-cased custom event #4803

Closed
@benkroeger

Description

@benkroeger

Version

3.2.20

Reproduction link

sfc.vuejs.org

Steps to reproduce

Open SFC

What is expected?

no warning to be logged as component defined onNewValue prop

What is actually happening?

warning in console:

Component emitted event "new-value" but it is neither declared in the emits option nor as an "onNew-value" prop.


Having a component that emits a kebab-cased event (e.g. new-value as in Quasar's QSelect), you see the following warning:

Component emitted event "new-value" but it is neither declared in the emits option nor as an "onNew-value" prop.

The component actually defines a prop named onNewValue - without listing new-value in the component's emits property.

It looks like this is due to the toHandlerKey helper only capitalizes the event name - which then only converts the first character to UPPERCASE.

Conventions done't allow non-camelized properties - so I think the toHandlerKey actually needs to capitalize(camelize(str))

Metadata

Metadata

Assignees

No one assigned

    Labels

    🧹 p1-chorePriority 1: this doesn't change code behavior.🐞 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions