From: Evan You Date: Wed, 18 Nov 2020 17:34:59 +0000 (-0500) Subject: wip: ensure string template refs work in inline mode X-Git-Tag: v3.0.3~34 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=760443dca6b132894c58d1144ae99b3fcf1d7957;p=thirdparty%2Fvuejs%2Fcore.git wip: ensure string template refs work in inline mode --- diff --git a/packages/compiler-core/src/transforms/transformElement.ts b/packages/compiler-core/src/transforms/transformElement.ts index f5f026bef8..e9e1ac5892 100644 --- a/packages/compiler-core/src/transforms/transformElement.ts +++ b/packages/compiler-core/src/transforms/transformElement.ts @@ -364,8 +364,15 @@ export function buildProps( const prop = props[i] if (prop.type === NodeTypes.ATTRIBUTE) { const { loc, name, value } = prop + let isStatic = true if (name === 'ref') { hasRef = true + // in inline mode there is no setupState object, so we can't use string + // keys to set the ref. Instead, we need to transform it to pass the + // acrtual ref instead. + if (!__BROWSER__ && context.inline) { + isStatic = false + } } // skip :is on if (name === 'is' && tag === 'component') { @@ -380,7 +387,7 @@ export function buildProps( ), createSimpleExpression( value ? value.content : '', - true, + isStatic, value ? value.loc : loc ) )