@using System.Text.Json
@if (_documents.Count > 0)
{
}
@code {
[Parameter]
public string Json { get; set; } = "[]";
private static readonly JsonSerializerOptions SerializerOptions = new()
{
PropertyNameCaseInsensitive = true
};
private List _documents { get; set; } = new();
protected override void OnParametersSet()
{
try
{
_documents = JsonSerializer.Deserialize>(Json, SerializerOptions) ?? new List();
}
catch
{
_documents = new List();
}
}
private sealed record DocumentLink(string Title, string Url);
}