From: Evan You Date: Fri, 31 Jan 2020 21:15:05 +0000 (-0500) Subject: fix(compiler-core): only check is prop on `` X-Git-Tag: v3.0.0-alpha.5~141 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=78c4f321cd0902a117c599ac705dda294fa198ed;p=thirdparty%2Fvuejs%2Fcore.git fix(compiler-core): only check is prop on `` --- diff --git a/packages/compiler-core/src/transforms/transformElement.ts b/packages/compiler-core/src/transforms/transformElement.ts index 0d907498b6..65963da280 100644 --- a/packages/compiler-core/src/transforms/transformElement.ts +++ b/packages/compiler-core/src/transforms/transformElement.ts @@ -73,27 +73,25 @@ export const transformElement: NodeTransform = (node, context) => { let shouldUseBlock = false // handle dynamic component - const isProp = findProp(node, 'is') - if (tag === 'component') { - if (isProp) { - // static - if (isProp.type === NodeTypes.ATTRIBUTE) { - const tag = isProp.value && isProp.value.content - if (tag) { - context.helper(RESOLVE_COMPONENT) - context.components.add(tag) - dynamicComponent = toValidAssetId(tag, `component`) - } - } - // dynamic - else if (isProp.exp) { - dynamicComponent = createCallExpression( - context.helper(RESOLVE_DYNAMIC_COMPONENT), - // _ctx.$ exposes the owner instance of current render function - [isProp.exp, context.prefixIdentifiers ? `_ctx.$` : `$`] - ) + const isProp = tag === 'component' && findProp(node, 'is') + if (isProp) { + // static + if (isProp.type === NodeTypes.ATTRIBUTE) { + const tag = isProp.value && isProp.value.content + if (tag) { + context.helper(RESOLVE_COMPONENT) + context.components.add(tag) + dynamicComponent = toValidAssetId(tag, `component`) } } + // dynamic + else if (isProp.exp) { + dynamicComponent = createCallExpression( + context.helper(RESOLVE_DYNAMIC_COMPONENT), + // _ctx.$ exposes the owner instance of current render function + [isProp.exp, context.prefixIdentifiers ? `_ctx.$` : `$`] + ) + } } let nodeType