Description
The Custom Events page sets a confusing and contradicting recommendation on event-name conventions.
At the top it recommends using kebab-case because HTML is case-insensitive:
Since event names will never be used as variable or property names in JavaScript, there is no reason to use camelCase or PascalCase. Additionally, v-on event listeners inside DOM templates will be automatically transformed to lowercase (due to HTML's case-insensitivity), so @myevent would become @myevent -- making myEvent impossible to listen to.
For these reasons, we recommend you always use kebab-case for event names.
However, a lot of code examples starting from the "Multiple v-model bindings" section contains camelCase event names:
$emit('update:firstName', $event.target.value)
-> v-model:firstName="firstName"
This statement seems inaccurate too, considering part of the event name (eg. update:dataProperty
) maps to a view-model property:
Since event names will never be used as variable or property names in JavaScript, there is no reason to use camelCase or PascalCase.
Edit: