mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-02 03:57:38 +08:00
37 lines
706 B
C#
37 lines
706 B
C#
|
@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);
|
|||
|
|
|||
|
}
|
|||
|
}
|