提交 00873931 编写于 作者: fxy060608's avatar fxy060608

fix(mp): component with setup-maybe-ref (#3213)

上级 7eea232d
......@@ -237,11 +237,26 @@ function findBindingComponent(
})
}
function normalizeComponentId(id: string) {
// _unref(test) => test
if (id.includes('_unref(')) {
return id.replace('_unref(', '').replace(')', '')
}
// $setup["test"] => test
if (id.includes('$setup[')) {
return id.replace('$setup["', '').replace('"', '')
}
return id
}
function parseBindingComponents(
templateBindingComponents: BindingComponents,
scriptBindingComponents: BindingComponents
) {
const bindingComponents: BindingComponents = { ...templateBindingComponents }
const bindingComponents: BindingComponents = {}
Object.keys(templateBindingComponents).forEach((id) => {
bindingComponents[normalizeComponentId(id)] = templateBindingComponents[id]
})
Object.keys(scriptBindingComponents).forEach((id) => {
const { tag } = scriptBindingComponents[id]
const name = findBindingComponent(tag, templateBindingComponents)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册