-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Using the camelCased event in the CDN cannot be triggered #2277
Comments
modify your code: worked. |
Because
It would be great if |
Maybe it's a bug. |
recommended usage: |
Thank you for your reply.That's the way I use it now, but writing the event names for the render functions is a little bad.
😄Expect events to support both camelCased & kebab-case. |
because we must use the converted event name in render function. |
It seems not a bug, but a feature. See function setFullProps(
instance: ComponentInternalInstance,
rawProps: Data | null,
props: Data,
attrs: Data
) {
const [options, needCastKeys] = instance.propsOptions
if (rawProps) {
for (const key in rawProps) {
const value = rawProps[key]
// key, ref are reserved and never passed down
if (isReservedProp(key)) {
continue
}
// prop option names are camelized during normalization, so to support
// kebab -> camel conversion here we need to camelize the key.
let camelKey
if (options && hasOwn(options, (camelKey = camelize(key)))) {
props[camelKey] = value
} else if (!isEmitListener(instance.emitsOptions, key)) {
// Any non-declared (either as a prop or an emitted event) props are put
// into a separate `attrs` object for spreading. Make sure to preserve
// original key casing
attrs[key] = value
}
}
}
if (needCastKeys) {
const rawCurrentProps = toRaw(props)
for (let i = 0; i < needCastKeys.length; i++) {
const key = needCastKeys[i]
props[key] = resolvePropValue(
options!,
rawCurrentProps,
key,
rawCurrentProps[key],
instance
)
}
}
} Any non-declared (either as a prop or an emitted event) props are put into a separate |
See #2249 |
Version
3.0.0
Reproduction link
https://jsfiddle.net/xcr4aLvy/
Steps to reproduce
CDN mode events cannot be triggered because HTML is not case sensitive
What is expected?
You want it to be triggered by the kebab-case event
What is actually happening?
The event cannot be triggered normally
The text was updated successfully, but these errors were encountered: