ant-design-blazor/site/AntDesign.Docs/Pages/Mock.razor
2021-02-06 20:15:46 +08:00

31 lines
694 B
C#

@layout BlankLayout;
@page "/mock"
@using System.Reflection
@using AntDesign.Docs.Services
<div id="@DemoId">
@ShowCaseContent
</div>
@inject DemoService demoService
@code
{
[Parameter]
public string DemoId { get; set; }
[Parameter]
public string Type { get; set; }
[Parameter(CaptureUnmatchedValues = true)]
public IDictionary<string,object> Attributes { get; set; }
RenderFragment ShowCaseContent => (builder) =>
{
var assemblyName = Assembly.GetExecutingAssembly().GetName().Name;
var showCase = System.Type.GetType($"{assemblyName}.{Type}");
builder.OpenComponent(0, showCase);
builder.CloseComponent();
};
}