可以将儿童内容添加到带有渲染的标记串中吗?
我有这样的代码;
@((MarkupString)$"<{item.Tagname}> {ChildContent} </{item.TagName}>")
中间的育儿是一个渲染对象,但输出如下。
“ Microsoft.aspnetcore.components.renderfragment”
是否有一种方法可以使其正常工作?
I have code like this;
@((MarkupString)quot;<{item.Tagname}> {ChildContent} </{item.TagName}>")
ChildContent in the middle is a RenderFragment object, but it outputs as follows;
"Microsoft.AspNetCore.Components.RenderFragment"
Is there a way to make it work normally this way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我猜您正在尝试这样做。
该示例使用
RenderTreeBuilder
来构造标记。这是为组件编写汇编程序的e quvalent,但是随着标记变得复杂,这是唯一明智的方法!如果您使用此方法一个建议单词:序列编号需要手动编码,请勿使用迭代器。
或作为完整组件:
I'm guessing you're trying to do something like this.
The example uses a
RenderTreeBuilder
to construct the markup. It's the eqivalent to writing assembler for components, but as the markup gets complex it's the only sensible way!If you use this method one word of advice: the sequence numbers need to be coded manually, do not use an iterator.
Or as a complete component: