feat: 添加 Card 是否显示

This commit is contained in:
zhangpeihang 2022-01-19 15:07:39 +08:00
parent 267d0e68bd
commit cacea459c1
2 changed files with 24 additions and 2 deletions

View File

@ -1,4 +1,4 @@
<Block Name="@AuthorizeKey">
<Block Name="@AuthorizeKey" OnQueryCondition="OnQueryCondition">
<Card IsShadow="true">
<CardHeader>
@HeaderText

View File

@ -1,4 +1,7 @@
namespace BootstrapAdmin.Web.Components
using BootstrapAdmin.Web.Core;
using BootstrapAdmin.Web.Services;
namespace BootstrapAdmin.Web.Components
{
/// <summary>
///
@ -24,5 +27,24 @@
/// </summary>
[Parameter]
public RenderFragment? ChildContent { get; set; }
[Inject]
[NotNull]
private INavigation? NavigationService { get; set; }
[Inject]
[NotNull]
private BootstrapAppContext? AppContext { get; set; }
[Inject]
[NotNull]
private NavigationManager? NavigationManager { get; set; }
private Task<bool> OnQueryCondition(string name)
{
var url = NavigationManager.ToBaseRelativePath(NavigationManager.Uri);
return Task.FromResult(NavigationService.AuthorizationBlock(AppContext.UserName, url, name));
}
}
}