Skip to content

Commit 250eb4a

Browse files
fix(runtime-core): properly capitalize v-on object keys (#1358)
1 parent e52b7cd commit 250eb4a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/runtime-core/__tests__/helpers/toHandlers.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ describe('toHandlers', () => {
1818
const change = () => {}
1919

2020
expect(toHandlers({ input, change })).toStrictEqual({
21-
oninput: input,
22-
onchange: change
21+
onInput: input,
22+
onChange: change
2323
})
2424
})
2525
})

packages/runtime-core/src/helpers/toHandlers.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { isObject } from '@vue/shared'
1+
import { isObject, capitalize } from '@vue/shared'
22
import { warn } from '../warning'
33

44
/**
@@ -12,7 +12,7 @@ export function toHandlers(obj: Record<string, any>): Record<string, any> {
1212
return ret
1313
}
1414
for (const key in obj) {
15-
ret[`on${key}`] = obj[key]
15+
ret[`on${capitalize(key)}`] = obj[key]
1616
}
1717
return ret
1818
}

0 commit comments

Comments
 (0)