wip: ensure string template refs work in inline mode

This commit is contained in:
Evan You 2020-11-18 12:34:59 -05:00
parent 27fca66c89
commit 760443dca6

View File

@ -364,8 +364,15 @@ export function buildProps(
const prop = props[i] const prop = props[i]
if (prop.type === NodeTypes.ATTRIBUTE) { if (prop.type === NodeTypes.ATTRIBUTE) {
const { loc, name, value } = prop const { loc, name, value } = prop
let isStatic = true
if (name === 'ref') { if (name === 'ref') {
hasRef = true 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 <component> // skip :is on <component>
if (name === 'is' && tag === 'component') { if (name === 'is' && tag === 'component') {
@ -380,7 +387,7 @@ export function buildProps(
), ),
createSimpleExpression( createSimpleExpression(
value ? value.content : '', value ? value.content : '',
true, isStatic,
value ? value.loc : loc value ? value.loc : loc
) )
) )