ant-design-blazor/components/core/Base/AntContainerComponentBase.cs

30 lines
971 B
C#
Raw Normal View History

2020-04-24 18:32:50 +08:00
using Microsoft.AspNetCore.Components;
2019-12-08 00:51:07 +08:00
using Microsoft.AspNetCore.Components.CompilerServices;
using Microsoft.AspNetCore.Components.Rendering;
namespace AntDesign
2019-12-08 00:51:07 +08:00
{
public abstract class AntContainerComponentBase : AntDomComponentBase
{
[Parameter]
public RenderFragment ChildContent { get; set; }
[Parameter]
public string Tag { get; set; } = "div";
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
2020-04-24 18:32:50 +08:00
if (builder != null)
{
builder.OpenElement(0, Tag);
builder.AddAttribute(1, "class", ClassMapper.Class);
builder.AddAttribute(2, "style", GenerateStyle());
builder.AddAttribute(4, "id", Id);
builder.AddElementReferenceCapture(5, (value) => { Ref = value; });
builder.AddContent(7, ChildContent);
builder.CloseElement();
}
2019-12-08 00:51:07 +08:00
}
}
}