From 1ce41105708affa6722f76e1fdf3a252b1c9d7b7 Mon Sep 17 00:00:00 2001 From: daiwei Date: Tue, 27 Oct 2020 14:52:43 +0800 Subject: [PATCH] fix(compiler-core): transform kebab case props to camelcase on slots (close #2488) --- .../src/transforms/transformSlotOutlet.ts | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/compiler-core/src/transforms/transformSlotOutlet.ts b/packages/compiler-core/src/transforms/transformSlotOutlet.ts index 5bb01368217..359618a4122 100644 --- a/packages/compiler-core/src/transforms/transformSlotOutlet.ts +++ b/packages/compiler-core/src/transforms/transformSlotOutlet.ts @@ -69,22 +69,19 @@ export function processSlotOutlet( const propsWithoutName = name ? node.props.filter(p => p !== name) : node.props + + //#2488 + propsWithoutName.forEach(prop => { + const arg = (prop as any).arg + if (arg) { + arg.content = camelize(arg.content) + } + }) + if (propsWithoutName.length > 0) { const { props, directives } = buildProps(node, context, propsWithoutName) slotProps = props - //#2488 - if ( - slotProps && - (slotProps as any).properties && - (slotProps as any).properties.length > 0 - ) { - for (let i = 0; i < (slotProps as any).properties.length; i++) { - const prop = (slotProps as any).properties[i] - prop.key.content = camelize(prop.key.content) - } - } - if (directives.length) { context.onError( createCompilerError(