fix(runtime-core): use consistent camelCase event casing for render functions (#2278)

close #2249
This commit is contained in:
shadowings-zy
2020-10-07 06:28:56 +08:00
committed by GitHub
parent 390589ec6d
commit 62f26173ba
3 changed files with 42 additions and 7 deletions

View File

@@ -42,10 +42,8 @@ export const transformOn: DirectiveTransform = (
if (arg.type === NodeTypes.SIMPLE_EXPRESSION) {
if (arg.isStatic) {
const rawName = arg.content
// for @vnode-xxx event listeners, auto convert it to camelCase
const normalizedName = rawName.startsWith(`vnode`)
? capitalize(camelize(rawName))
: capitalize(rawName)
// for all event listeners, auto convert it to camelCase. See issue #2249
const normalizedName = capitalize(camelize(rawName))
eventName = createSimpleExpression(`on${normalizedName}`, true, arg.loc)
} else {
eventName = createCompoundExpression([