refactor: 重构 AdminAlert 组件

This commit is contained in:
Argo-Tianyi 2021-12-25 15:47:27 +08:00
parent 99b6da65af
commit 35339d7ebf
2 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,12 @@
<Block Condition="IsDemo"> <Block Condition="IsDemo">
<Alert Icon="fa fa-warning" Color="Color.Info">@Text</Alert> <Alert Icon="fa fa-warning" Color="@Color">
@if (ChildContent != null)
{
@ChildContent
}
else
{
@Text
}
</Alert>
</Block> </Block>

View File

@ -7,6 +7,12 @@ public partial class AdminAlert
[Parameter] [Parameter]
public string? Text { get; set; } public string? Text { get; set; }
[Parameter]
public RenderFragment? ChildContent { get; set; }
[Parameter]
public Color Color { get; set; } = Color.Danger;
private bool IsDemo { get; set; } private bool IsDemo { get; set; }
[Inject] [Inject]