RenderTreeBuilder 的扩展
The extensions of RenderTreeBuilder
CreateElement
builder.CreateElement(0, "div", "content", new { @class="sub-title" });<div class="sub-title">content</div>CreateComponent
builder.CreateComponent<Component>(0, attributes: new { Active = true, style = "display:flex" });CreateStyleRegion
builder.CreateStyleRegion(selector => {
selector.AddStyle(".head", new {
font_size = "16px",
color = "#ff0000",
font_weight = "bolder"
})
.AddStyle(".bigger", new { animation = "tran 3s" });
.AddKeyFrames("tran", frame =>
{
frame.Add("from", new { width = "0px" })
.Add("to", new { width = "100px" });
});
})BlazorRenderTree
子内容
使用 Open 作为组件或元素的开始标记,然后使用 Close 作为结束标记
可以使用 using 关键字来自动作为结束标记
Last updated