Skip to content

Commit

Permalink
fix(compiler-core): Convert event listeners to camelCase to fix incon…
Browse files Browse the repository at this point in the history
…sistent event casing for in-DOM template(#2249)
  • Loading branch information
shadowings-zy committed Oct 2, 2020
1 parent b6a4765 commit fee467a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/compiler-core/src/transforms/vOn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down

0 comments on commit fee467a

Please sign in to comment.