mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-05 05:27:37 +08:00
36 lines
647 B
C#
36 lines
647 B
C#
@using AntDesign.Docs.Highlight
|
|
|
|
<pre class="language-@Language">
|
|
<code>
|
|
@sourceCode
|
|
</code>
|
|
</pre>
|
|
|
|
@inject IPrismHighlighter Highlighter
|
|
|
|
@code {
|
|
|
|
[Parameter]
|
|
public string Code { get; set; }
|
|
|
|
[Parameter]
|
|
public string Language { get; set; }
|
|
|
|
[Parameter]
|
|
public bool CanLoad { get; set; }
|
|
|
|
MarkupString sourceCode { get; set; }
|
|
|
|
bool hasLoaded = false;
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
if (CanLoad && !hasLoaded)
|
|
{
|
|
sourceCode = await Highlighter.HighlightAsync(Code, Language);
|
|
hasLoaded = true;
|
|
}
|
|
}
|
|
|
|
}
|