fix(runtime-core): fix v-on object kebab-case event emit matching

fix #3527
This commit is contained in:
Evan You
2021-04-01 19:47:58 -04:00
parent 995d76bd12
commit c1cd42e627
2 changed files with 60 additions and 8 deletions

View File

@@ -114,14 +114,15 @@ export function emit(
}
}
// convert handler name to camelCase. See issue #2249
let handlerName = toHandlerKey(camelize(event))
let handler = props[handlerName]
let handlerName
let handler =
props[(handlerName = toHandlerKey(event))] ||
// also try camelCase event handler (#2249)
props[(handlerName = toHandlerKey(camelize(event)))]
// for v-model update:xxx events, also trigger kebab-case equivalent
// for props passed via kebab-case
if (!handler && isModelListener) {
handlerName = toHandlerKey(hyphenate(event))
handler = props[handlerName]
handler = props[(handlerName = toHandlerKey(hyphenate(event)))]
}
if (handler) {