ant-design-blazor/site/AntDesign.Docs/Shared/DocDemoView.razor
2024-09-10 12:30:05 +08:00

37 lines
706 B
C#
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@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);
}
}