use render
This commit is contained in:
parent
d8962dbc08
commit
f754b85c8d
@ -2381,15 +2381,29 @@ class LiteralComponentVar(CachedVarOperation, LiteralVar, ComponentVar):
|
|||||||
Returns:
|
Returns:
|
||||||
The name of the var.
|
The name of the var.
|
||||||
"""
|
"""
|
||||||
tag = self._var_value._render()
|
tag = self._var_value.render()
|
||||||
|
|
||||||
props = Var.create(tag.props).to(ObjectVar)
|
props = {}
|
||||||
for prop in tag.special_props:
|
|
||||||
|
special_props = []
|
||||||
|
|
||||||
|
for prop_str in tag["props"]:
|
||||||
|
if "=" not in prop_str:
|
||||||
|
special_props.append(Var(prop_str).to(ObjectVar))
|
||||||
|
continue
|
||||||
|
prop = prop_str.index("=")
|
||||||
|
key = prop_str[:prop]
|
||||||
|
value = prop_str[prop + 2 : -1]
|
||||||
|
props[key] = value
|
||||||
|
|
||||||
|
props = Var.create({Var.create(k): Var(v) for k, v in props.items()})
|
||||||
|
|
||||||
|
for prop in special_props:
|
||||||
props = props.merge(prop)
|
props = props.merge(prop)
|
||||||
|
|
||||||
contents = getattr(self._var_value, "contents", None)
|
contents = tag["contents"][1:-1] if tag["contents"] else None
|
||||||
|
|
||||||
tag_name = Var(tag.name) if tag.name else Var("Fragment")
|
tag_name = Var(tag.get("name", None) or "Fragment")
|
||||||
|
|
||||||
return str(
|
return str(
|
||||||
FunctionStringVar.create(
|
FunctionStringVar.create(
|
||||||
@ -2397,7 +2411,7 @@ class LiteralComponentVar(CachedVarOperation, LiteralVar, ComponentVar):
|
|||||||
).call(
|
).call(
|
||||||
tag_name,
|
tag_name,
|
||||||
props,
|
props,
|
||||||
*([Var.create(contents)] if contents is not None else []),
|
*([Var(contents)] if contents is not None else []),
|
||||||
*[Var.create(child) for child in self._var_value.children],
|
*[Var.create(child) for child in self._var_value.children],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user