fix(runtime-core): properly capitalize v-on object keys (#1358)

This commit is contained in:
Cathrine Vaage 2020-06-15 17:12:08 +02:00 committed by GitHub
parent e52b7cd7e7
commit 250eb4a5bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -18,8 +18,8 @@ describe('toHandlers', () => {
const change = () => {}
expect(toHandlers({ input, change })).toStrictEqual({
oninput: input,
onchange: change
onInput: input,
onChange: change
})
})
})

View File

@ -1,4 +1,4 @@
import { isObject } from '@vue/shared'
import { isObject, capitalize } from '@vue/shared'
import { warn } from '../warning'
/**
@ -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
}