ant-design-blazor/site/AntDesign.Docs/Shared/DocDemoView.razor

37 lines
706 B
C#
Raw Permalink Normal View History

2024-09-10 12:30:05 +08:00
@using AntDesign.Docs.Services
@using System.Reflection;
@inherits ComponentBase
@if (_demoType != null)
{
<DynamicComponent Type="_demoType" />
}
@inject DemoService demoService;
@code {
[Parameter]
public DemoItem Demo { get; set; }
private Type _demoType;
private bool _render;
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
_render = true;
StateHasChanged();
return;
}
if (_render && _demoType == null)
{
_demoType = demoService.GetShowCase(Demo.Type);
StateHasChanged();
}
base.OnAfterRender(firstRender);
}
}