From 70d1845c3610486b95cec56786e1cf8b5daa7b5d Mon Sep 17 00:00:00 2001 From: Cathrine Vaage Date: Sun, 14 Jun 2020 03:02:19 +0200 Subject: [PATCH] fix(runtime-core): properly change v-on object keys --- packages/runtime-core/__tests__/helpers/toHandlers.spec.ts | 4 ++-- packages/runtime-core/src/helpers/toHandlers.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/runtime-core/__tests__/helpers/toHandlers.spec.ts b/packages/runtime-core/__tests__/helpers/toHandlers.spec.ts index 000f9004952..44351b76871 100644 --- a/packages/runtime-core/__tests__/helpers/toHandlers.spec.ts +++ b/packages/runtime-core/__tests__/helpers/toHandlers.spec.ts @@ -18,8 +18,8 @@ describe('toHandlers', () => { const change = () => {} expect(toHandlers({ input, change })).toStrictEqual({ - oninput: input, - onchange: change + onInput: input, + onChange: change }) }) }) diff --git a/packages/runtime-core/src/helpers/toHandlers.ts b/packages/runtime-core/src/helpers/toHandlers.ts index a7beede7ee9..38022edd7d9 100644 --- a/packages/runtime-core/src/helpers/toHandlers.ts +++ b/packages/runtime-core/src/helpers/toHandlers.ts @@ -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): Record { return ret } for (const key in obj) { - ret[`on${key}`] = obj[key] + ret[`on${capitalize(key)}`] = obj[key] } return ret }