fix(runtime-core): properly capitalize v-on object keys (#1358)
This commit is contained in:
parent
e52b7cd7e7
commit
250eb4a5bc
@ -18,8 +18,8 @@ describe('toHandlers', () => {
|
|||||||
const change = () => {}
|
const change = () => {}
|
||||||
|
|
||||||
expect(toHandlers({ input, change })).toStrictEqual({
|
expect(toHandlers({ input, change })).toStrictEqual({
|
||||||
oninput: input,
|
onInput: input,
|
||||||
onchange: change
|
onChange: change
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { isObject } from '@vue/shared'
|
import { isObject, capitalize } from '@vue/shared'
|
||||||
import { warn } from '../warning'
|
import { warn } from '../warning'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -12,7 +12,7 @@ export function toHandlers(obj: Record<string, any>): Record<string, any> {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
ret[`on${key}`] = obj[key]
|
ret[`on${capitalize(key)}`] = obj[key]
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user