Skip to content

Commit 42a2737

Browse files
authored
feat: support path base (#117)
1 parent e7899ac commit 42a2737

File tree

10 files changed

+18
-14
lines changed

10 files changed

+18
-14
lines changed

src/layout/example/AntDesign.ProLayout.Wasm/Shared/ProLayout.razor

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
@inherits LayoutComponentBase
22

33
<BasicLayout
4-
Logo="@("https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg")"
4+
Logo="@("logo.png")"
55
MenuData="MenuData"
66
Theme="MenuTheme.Light"
77
MenuAccordion
8+
BaseURL=""
89
@bind-OpenKeys="openKeys"
910
@bind-Collapsed="collapsed"
1011
@bind-SelectedKeys=selectedKeys>

src/layout/example/AntDesign.ProLayout.Wasm/wwwroot/data/menu.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
[
22
{
3-
"path": "/",
3+
"path": "",
44
"name": "welcome",
55
"key": "welcome",
66
"icon": "smile"
77
},
88
{
9-
"path": "/admin",
9+
"path": "admin",
1010
"name": "admin",
1111
"key": "admin",
1212
"icon": "crown",
1313
"children": [
1414
{
15-
"path": "/admin/sub-page",
15+
"path": "admin/sub-page",
1616
"name": "sub-page",
1717
"key": "admin.sub-page",
1818
"icon": "crown"
1919
},
2020
{
21-
"path": "/admin/sub-page2",
21+
"path": "admin/sub-page2",
2222
"name": "sub-page2",
2323
"key": "admin.sub-page2",
2424
"icon": "crown"
2525
},
2626
{
27-
"path": "/admin/sub-page3",
27+
"path": "admin/sub-page3",
2828
"name": "sub-page3",
2929
"key": "admin.sub-page3",
3030
"icon": "crown"
3131
}
3232
]
3333
},
3434
{
35-
"path": "/list",
35+
"path": "list",
3636
"name": "list.table-list",
3737
"key": "list.table-list",
3838
"icon": "table",
3939
"children": [
4040
{
41-
"path": "/list/sub-page",
41+
"path": "list/sub-page",
4242
"name": "sub-page",
4343
"key": "list.sub-page",
4444
"icon": "crown"
4545
},
4646
{
47-
"path": "/list/sub-page2",
47+
"path": "list/sub-page2",
4848
"name": "sub-page2",
4949
"key": "list.sub-page2",
5050
"icon": "crown"
Loading

src/layout/src/BasicLayout.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
@if (HeaderRender && Pure)
3939
{
4040
<CascadingValue Value="RightContentRender" Name="RightContentRender">
41-
<HeaderView SiderWidth="SiderWidth" Logo="Logo" MenuData="MenuData" Title="@Title" HeaderContentRender="HeaderContentRender" />
41+
<HeaderView SiderWidth="SiderWidth" Logo="Logo" MenuData="MenuData" Title="@Title" HeaderContentRender="HeaderContentRender" BaseURL="@BaseURL" />
4242
</CascadingValue>
4343
}
4444

src/layout/src/BasicLayout.razor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public partial class BasicLayout : IBasicLayout
4040
[Parameter] public EventCallback<string[]> OpenKeysChanged { get; set; }
4141
[Parameter] public MenuTheme Theme { get; set; }
4242
[Parameter] public OneOf<string, RenderFragment> Logo { get; set; }
43-
[Parameter] public string BaseURL { get; set; } = "/";
43+
[Parameter] public string BaseURL { get; set; } = "";
4444
[Parameter] public int SiderWidth { get; set; } = 208;
4545
[Parameter] public RenderFragment MenuExtraRender { get; set; }
4646
[Parameter] public bool MenuAccordion { get; set; }

src/layout/src/GlobalHeader/GlobalHeader.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ else
4949
if (Layout == Layout.Mix)
5050
{
5151
<div class="@BaseClassName-logo" style="min-width:@(SiderWidth)px">
52-
<a href="/">
52+
<a href="@BaseURL">
5353
@if (Logo.IsT0)
5454
{
5555
<img src="@Logo.AsT0" alt="@Logo.AsT0" />

src/layout/src/GlobalHeader/GlobalHeader.razor.cs

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public partial class GlobalHeader : AntProComponentBase, IGlobalHeader
3939
[Parameter]
4040
public OneOf<string, RenderFragment> Logo { get; set; }
4141

42+
[Parameter] public string BaseURL { get; set; } = "";
43+
4244
[CascadingParameter(Name = nameof(RightContentRender))]
4345
public RenderFragment RightContentRender { get; set; }
4446

src/layout/src/HeaderView.razor

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
}
1313
else
1414
{
15-
<GlobalHeader SiderWidth="SiderWidth" Logo="Logo" Title="@Title">
15+
<GlobalHeader SiderWidth="SiderWidth" Logo="Logo" Title="@Title" BaseURL="@BaseURL">
1616
@HeaderContentRender
1717
</GlobalHeader>
1818
}

src/layout/src/HeaderView.razor.cs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public partial class HeaderView : IHeaderView
2121
public string PrefixCls { get; set; } = "ant-pro";
2222
[Parameter] public bool Collapsed { get; set; }
2323
[Parameter] public bool IsMobile { get; set; }
24+
[Parameter] public string BaseURL { get; set; } = "";
2425
[Parameter] public OneOf<string, RenderFragment> Logo { get; set; }
2526
[Parameter] public bool HasSiderMenu { get; set; }
2627
[Parameter] public int SiderWidth { get; set; }

src/layout/src/SiderMenu/SiderMenu.razor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public partial class SiderMenu : ISiderMenu
3535
[Parameter] public EventCallback<bool> OnCollapse { get; set; }
3636
[Parameter] public string[] OpenKeys { get; set; } = [];
3737
[Parameter] public OneOf<string, RenderFragment> Logo { get; set; }
38-
[Parameter] public string BaseURL { get; set; } = "/";
38+
[Parameter] public string BaseURL { get; set; } = "";
3939
[Parameter] public int SiderWidth { get; set; } = 208;
4040
[Parameter] public BreakpointType Breakpoint { get; set; } = BreakpointType.Lg;
4141
[Parameter] public bool Hide { get; set; }

0 commit comments

Comments
 (0)