Skip to content
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

fix(runtime-core): properly change v-on object keys #1358

Merged

Conversation

cathrinevaage
Copy link
Contributor

emit('eventName') will call a prop with the name onEventName.
@eventName="eventHandler" will be compiled into the prop onEventName: event => _ctx.eventHandler(event).
Both of those are completely fine, and event handlers are called as expected.

If you opt to use v-on with an object, it will probably not work as expected.
v-on="{ eventName: eventHandler }" is compiled to prop { oneventName: eventhandler }, and will thus never be called by emit('eventName').
Currently you'll have to capitalize the event name, v-on"{ EventName: eventHandler }".
This is clunky, and it breaks with the common pattern that event names are in camelCase.

This PR fixes this by capitalizing the object keys before they're prepended with 'on'.

@yyx990803 yyx990803 merged commit 250eb4a into vuejs:master Jun 15, 2020
@cathrinevaage cathrinevaage deleted the fix/properly-change-v-on-object-keys branch June 15, 2020 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants