fix: DefaultLayout 组件 HomeUrl 属性支持 PathBase
This commit is contained in:
parent
1867653767
commit
43fdbf1d03
|
@ -115,11 +115,17 @@ namespace Bootstrap.Admin.Pages.Components
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 设置参数方法
|
/// 设置参数方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void OnParametersSet()
|
public override Task SetParametersAsync(ParameterView parameters)
|
||||||
{
|
{
|
||||||
RequestUrl = new UriBuilder(NavigationManager?.Uri ?? "").Path;
|
parameters.SetParameterProperties(this);
|
||||||
Model = new NavigatorBarModel(UserName, RequestUrl.ToMvcMenuUrl());
|
if (NavigationManager != null)
|
||||||
DisplayName = Model.DisplayName;
|
{
|
||||||
|
RequestUrl = new UriBuilder(NavigationManager.Uri).Path;
|
||||||
|
Model = new NavigatorBarModel(UserName, RequestUrl.ToMvcMenuUrl());
|
||||||
|
DisplayName = Model.DisplayName;
|
||||||
|
HomeUrl = NavigationManager.ToBlazorLink(HomeUrl);
|
||||||
|
}
|
||||||
|
return base.SetParametersAsync(ParameterView.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Bootstrap.Admin.Pages.Components
|
||||||
/// 获得 根模板页实例
|
/// 获得 根模板页实例
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[CascadingParameter(Name = "Default")]
|
[CascadingParameter(Name = "Default")]
|
||||||
public DefaultLayout RootLayout { get; protected set; } = new DefaultLayout();
|
public DefaultLayout? RootLayout { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得/设置 用户显示名称
|
/// 获得/设置 用户显示名称
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<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="@NavigationManager.ToBlazorLink(RootLayout.HomeUrl)">
|
<a href="@RootLayout?.HomeUrl">
|
||||||
<img src="@Model.WebSiteLogo.ToBlazorLink()" />
|
<img src="@Model.WebSiteLogo.ToBlazorLink()" />
|
||||||
<span>@Model.Title</span>
|
<span>@Model.Title</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in New Issue