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