@using AntDesign.JsInterop
@using AntDesign.Docs.Services
@inherits ComponentBase
@if (Demo.Iframe > 0)
{
}
else
{
@Component
}
@inject InteropService InteropService
@inject DemoService demoService;
@inject ILanguageService lang;
@code {
[Parameter]
public string ComponentName { get; set; }
[Parameter]
public DemoItem Demo { get; set; }
[Parameter]
public bool CodeExpand { get; set; }
RenderFragment Component;
RenderFragment DebugIcon;
private bool _copied;
protected string DemoId => $"components-{ComponentName.ToLower()}-demo-{Demo.Name}";
private string EditUrl => $"https://github.com/ant-design-blazor/ant-design-blazor/edit/master/site/AntDesign.Docs/Demos/Components/{ComponentName}/demo/{Demo.Name}.razor";
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
Component = demoService.GetShowCase(Demo.Type);
#if DEBUG
DebugIcon =@
;
#endif
}
async Task Copy()
{
await InteropService.Copy(Demo.Code);
_copied = true;
}
async Task AnchorClick()
{
await InteropService.JsInvokeAsync("window.eval", $"window.location.hash='{DemoId}'");
}
}