fix: 侧边栏链接支持 pathbase

This commit is contained in:
argo zhang 2020-02-11 14:10:19 +08:00
parent 4bb1612b3f
commit 1867653767
2 changed files with 9 additions and 3 deletions

View File

@ -9,6 +9,12 @@ namespace Bootstrap.Admin.Pages.Components
/// </summary> /// </summary>
public class SideBarBase : ComponentBase public class SideBarBase : ComponentBase
{ {
/// <summary>
/// 获得 NavigationManager 实例
/// </summary>
[Inject]
public NavigationManager? NavigationManager { get; set; }
/// <summary> /// <summary>
/// 获得/设置 侧边栏绑定 Model 实例 /// 获得/设置 侧边栏绑定 Model 实例
/// </summary> /// </summary>

View File

@ -3,14 +3,14 @@
<aside class="@Model.ShowSideBar"> <aside class="@Model.ShowSideBar">
<div class="bg"></div> <div class="bg"></div>
<div class="nav-brand justify-content-center"> <div class="nav-brand justify-content-center">
<a href="@RootLayout.HomeUrl"> <a href="@NavigationManager.ToBlazorLink(RootLayout.HomeUrl)">
<img src="@Model.WebSiteLogo.ToBlazorLink()" /> <img src="@Model.WebSiteLogo.ToBlazorLink()" />
<span>@Model.Title</span> <span>@Model.Title</span>
</a> </a>
</div> </div>
<div class="nav-header flex-fill align-items-center"> <div class="nav-header flex-fill align-items-center">
<a href="/Pages/Admin/Profiles"> <a href="@NavigationManager.ToBlazorLink("/Pages/Admin/Profiles")">
<img src="@Model.Icon.ToBlazorLink()" /> <img src="@NavigationManager.ToBlazorLink(Model.Icon.ToBlazorLink())" />
<span class="username d-inline-block text-truncate flex-fill">@DisplayName</span> <span class="username d-inline-block text-truncate flex-fill">@DisplayName</span>
</a> </a>
</div> </div>