From 250eb4a5bc121d303aa109c20251c95616049f05 Mon Sep 17 00:00:00 2001 From: Cathrine Vaage Date: Mon, 15 Jun 2020 17:12:08 +0200 Subject: [PATCH] fix(runtime-core): properly capitalize v-on object keys (#1358) --- 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 000f9004..44351b76 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 a7beede7..38022edd 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 }