Skip to content

feat: support base url #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@inherits LayoutComponentBase

<BasicLayout
Logo="@("https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg")"
Logo="@("logo.png")"
MenuData="MenuData"
Theme="MenuTheme.Light"
MenuAccordion
BaseURL=""
@bind-OpenKeys="openKeys"
@bind-Collapsed="collapsed"
@bind-SelectedKeys=selectedKeys>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
[
{
"path": "/",
"path": "",
"name": "welcome",
"key": "welcome",
"icon": "smile"
},
{
"path": "/admin",
"path": "admin",
"name": "admin",
"key": "admin",
"icon": "crown",
"children": [
{
"path": "/admin/sub-page",
"path": "admin/sub-page",
"name": "sub-page",
"key": "admin.sub-page",
"icon": "crown"
},
{
"path": "/admin/sub-page2",
"path": "admin/sub-page2",
"name": "sub-page2",
"key": "admin.sub-page2",
"icon": "crown"
},
{
"path": "/admin/sub-page3",
"path": "admin/sub-page3",
"name": "sub-page3",
"key": "admin.sub-page3",
"icon": "crown"
}
]
},
{
"path": "/list",
"path": "list",
"name": "list.table-list",
"key": "list.table-list",
"icon": "table",
"children": [
{
"path": "/list/sub-page",
"path": "list/sub-page",
"name": "sub-page",
"key": "list.sub-page",
"icon": "crown"
},
{
"path": "/list/sub-page2",
"path": "list/sub-page2",
"name": "sub-page2",
"key": "list.sub-page2",
"icon": "crown"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/layout/src/BasicLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@if (HeaderRender && Pure)
{
<CascadingValue Value="RightContentRender" Name="RightContentRender">
<HeaderView SiderWidth="SiderWidth" Logo="Logo" MenuData="MenuData" Title="@Title" HeaderContentRender="HeaderContentRender" />
<HeaderView SiderWidth="SiderWidth" Logo="Logo" MenuData="MenuData" Title="@Title" HeaderContentRender="HeaderContentRender" BaseURL="@BaseURL" />
</CascadingValue>
}

Expand Down
2 changes: 1 addition & 1 deletion src/layout/src/BasicLayout.razor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;

Check warning on line 1 in src/layout/src/BasicLayout.razor.cs

View workflow job for this annotation

GitHub Actions / build

'BasicLayout.OnCollapse' is obsolete: 'use CollapsedChanged or @bind-Collapsed instead.' [/home/runner/work/blazor-pro-components/blazor-pro-components/src/layout/src/AntDesign.ProLayout.csproj::TargetFramework=netstandard2.1]

Check warning on line 1 in src/layout/src/BasicLayout.razor.cs

View workflow job for this annotation

GitHub Actions / build

'BasicLayout.OnCollapse' is obsolete: 'use CollapsedChanged or @bind-Collapsed instead.' [/home/runner/work/blazor-pro-components/blazor-pro-components/src/layout/src/AntDesign.ProLayout.csproj::TargetFramework=netstandard2.1]

Check warning on line 1 in src/layout/src/BasicLayout.razor.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BasicLayout' [/home/runner/work/blazor-pro-components/blazor-pro-components/src/layout/src/AntDesign.ProLayout.csproj::TargetFramework=netstandard2.1]

Check warning on line 1 in src/layout/src/BasicLayout.razor.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BasicLayout.PrefixCls' [/home/runner/work/blazor-pro-components/blazor-pro-components/src/layout/src/AntDesign.ProLayout.csproj::TargetFramework=netstandard2.1]

Check warning on line 1 in src/layout/src/BasicLayout.razor.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BasicLayout.BaseClassName' [/home/runner/work/blazor-pro-components/blazor-pro-components/src/layout/src/AntDesign.ProLayout.csproj::TargetFramework=netstandard2.1]

Check warning on line 1 in src/layout/src/BasicLayout.razor.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BasicLayout.ContentClassMapper' [/home/runner/work/blazor-pro-components/blazor-pro-components/src/layout/src/AntDesign.ProLayout.csproj::TargetFramework=netstandard2.1]

Check warning on line 1 in src/layout/src/BasicLayout.razor.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BasicLayout.Collapsed' [/home/runner/work/blazor-pro-components/blazor-pro-components/src/layout/src/AntDesign.ProLayout.csproj::TargetFramework=netstandard2.1]

Check warning on line 1 in src/layout/src/BasicLayout.razor.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BasicLayout.CollapsedChanged' [/home/runner/work/blazor-pro-components/blazor-pro-components/src/layout/src/AntDesign.ProLayout.csproj::TargetFramework=netstandard2.1]

Check warning on line 1 in src/layout/src/BasicLayout.razor.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BasicLayout.HandleOpenChange' [/home/runner/work/blazor-pro-components/blazor-pro-components/src/layout/src/AntDesign.ProLayout.csproj::TargetFramework=netstandard2.1]

Check warning on line 1 in src/layout/src/BasicLayout.razor.cs

View workflow job for this annotation

GitHub Actions / build

Missing XML comment for publicly visible type or member 'BasicLayout.IsMobile' [/home/runner/work/blazor-pro-components/blazor-pro-components/src/layout/src/AntDesign.ProLayout.csproj::TargetFramework=netstandard2.1]
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
Expand Down Expand Up @@ -40,7 +40,7 @@
[Parameter] public EventCallback<string[]> OpenKeysChanged { get; set; }
[Parameter] public MenuTheme Theme { get; set; }
[Parameter] public OneOf<string, RenderFragment> Logo { get; set; }
[Parameter] public string BaseURL { get; set; } = "/";
[Parameter] public string BaseURL { get; set; } = "";
[Parameter] public int SiderWidth { get; set; } = 208;
[Parameter] public RenderFragment MenuExtraRender { get; set; }
[Parameter] public bool MenuAccordion { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/layout/src/GlobalHeader/GlobalHeader.razor
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ else
if (Layout == Layout.Mix)
{
<div class="@BaseClassName-logo" style="min-width:@(SiderWidth)px">
<a href="/">
<a href="@BaseURL">
@if (Logo.IsT0)
{
<img src="@Logo.AsT0" alt="@Logo.AsT0" />
Expand Down
2 changes: 2 additions & 0 deletions src/layout/src/GlobalHeader/GlobalHeader.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public partial class GlobalHeader : AntProComponentBase, IGlobalHeader
[Parameter]
public OneOf<string, RenderFragment> Logo { get; set; }

[Parameter] public string BaseURL { get; set; } = "";

[CascadingParameter(Name = nameof(RightContentRender))]
public RenderFragment RightContentRender { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion src/layout/src/HeaderView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
else
{
<GlobalHeader SiderWidth="SiderWidth" Logo="Logo" Title="@Title">
<GlobalHeader SiderWidth="SiderWidth" Logo="Logo" Title="@Title" BaseURL="@BaseURL">
@HeaderContentRender
</GlobalHeader>
}
Expand Down
1 change: 1 addition & 0 deletions src/layout/src/HeaderView.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public partial class HeaderView : IHeaderView
public string PrefixCls { get; set; } = "ant-pro";
[Parameter] public bool Collapsed { get; set; }
[Parameter] public bool IsMobile { get; set; }
[Parameter] public string BaseURL { get; set; } = "";
[Parameter] public OneOf<string, RenderFragment> Logo { get; set; }
[Parameter] public bool HasSiderMenu { get; set; }
[Parameter] public int SiderWidth { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/layout/src/SiderMenu/SiderMenu.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public partial class SiderMenu : ISiderMenu
[Parameter] public EventCallback<bool> OnCollapse { get; set; }
[Parameter] public string[] OpenKeys { get; set; } = [];
[Parameter] public OneOf<string, RenderFragment> Logo { get; set; }
[Parameter] public string BaseURL { get; set; } = "/";
[Parameter] public string BaseURL { get; set; } = "";
[Parameter] public int SiderWidth { get; set; } = 208;
[Parameter] public BreakpointType Breakpoint { get; set; } = BreakpointType.Lg;
[Parameter] public bool Hide { get; set; }
Expand Down
Loading