From cacea459c13af8bc05c9691c8048ea4f527def28 Mon Sep 17 00:00:00 2001 From: zhangpeihang <948869991@qq.com> Date: Wed, 19 Jan 2022 15:07:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20=20Card=20?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/AdminCard.razor | 2 +- .../Components/AdminCard.razor.cs | 24 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/AdminCard.razor b/src/blazor/admin/BootstrapAdmin.Web/Components/AdminCard.razor index a7aefadc..0682ea0d 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Components/AdminCard.razor +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/AdminCard.razor @@ -1,4 +1,4 @@ - + @HeaderText diff --git a/src/blazor/admin/BootstrapAdmin.Web/Components/AdminCard.razor.cs b/src/blazor/admin/BootstrapAdmin.Web/Components/AdminCard.razor.cs index e1fe28cb..1f6cedcd 100644 --- a/src/blazor/admin/BootstrapAdmin.Web/Components/AdminCard.razor.cs +++ b/src/blazor/admin/BootstrapAdmin.Web/Components/AdminCard.razor.cs @@ -1,4 +1,7 @@ -namespace BootstrapAdmin.Web.Components +using BootstrapAdmin.Web.Core; +using BootstrapAdmin.Web.Services; + +namespace BootstrapAdmin.Web.Components { /// /// @@ -24,5 +27,24 @@ /// [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 OnQueryCondition(string name) + { + var url = NavigationManager.ToBaseRelativePath(NavigationManager.Uri); + + return Task.FromResult(NavigationService.AuthorizationBlock(AppContext.UserName, url, name)); + } } }