refactor: simplify resolveDyanmicComponent

This commit is contained in:
Evan You
2020-03-16 12:46:15 -04:00
parent 9ad65b1653
commit 19228a469a
3 changed files with 8 additions and 16 deletions

View File

@@ -814,8 +814,7 @@ describe('compiler: element transform', () => {
{
type: NodeTypes.SIMPLE_EXPRESSION,
content: 'foo'
},
'$'
}
]
}
})

View File

@@ -215,11 +215,9 @@ export function resolveComponentType(
}
// dynamic <component :is="asdf" />
else if (isProp.exp) {
return createCallExpression(
context.helper(RESOLVE_DYNAMIC_COMPONENT),
// _ctx.$ exposes the owner instance of current render function
[isProp.exp, context.prefixIdentifiers ? `_ctx.$` : `$`]
)
return createCallExpression(context.helper(RESOLVE_DYNAMIC_COMPONENT), [
isProp.exp
])
}
}