Skip to content

Commit

Permalink
fix(runtime-core): properly capitalize v-on object keys (#1358)
Browse files Browse the repository at this point in the history
  • Loading branch information
cathrinevaage authored Jun 15, 2020
1 parent e52b7cd commit 250eb4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/runtime-core/__tests__/helpers/toHandlers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ describe('toHandlers', () => {
const change = () => {}

expect(toHandlers({ input, change })).toStrictEqual({
oninput: input,
onchange: change
onInput: input,
onChange: change
})
})
})
4 changes: 2 additions & 2 deletions packages/runtime-core/src/helpers/toHandlers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isObject } from '@vue/shared'
import { isObject, capitalize } from '@vue/shared'
import { warn } from '../warning'

/**
Expand All @@ -12,7 +12,7 @@ export function toHandlers(obj: Record<string, any>): Record<string, any> {
return ret
}
for (const key in obj) {
ret[`on${key}`] = obj[key]
ret[`on${capitalize(key)}`] = obj[key]
}
return ret
}

0 comments on commit 250eb4a

Please sign in to comment.