Skip to content

Commit 72cfffa

Browse files
committed
use base url for sceond app
1 parent 18ecb15 commit 72cfffa

File tree

3 files changed

+50
-50
lines changed

3 files changed

+50
-50
lines changed

src/layout/src/AntDesign.ProLayout.csproj

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,17 @@
2424
</ItemGroup>
2525

2626
<ItemGroup>
27-
<PackageReference Include="AntDesign" Version="0.16.2" />
27+
<!--<PackageReference Include="AntDesign" Version="0.16.2" />-->
2828
</ItemGroup>
2929

3030
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' And '$(SolutionDir)'==''">
3131
<SolutionDir>../../../</SolutionDir>
3232
</PropertyGroup>
3333

34-
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SolutionDir)node_modules') ">
35-
<!-- Ensure Node.js is installed -->
36-
<Exec Command="node --version" ContinueOnError="true">
37-
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
38-
</Exec>
39-
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
40-
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
41-
<Exec WorkingDirectory="$(SolutionDir)" Command="npm install" />
42-
</Target>
4334

44-
<Target Name="DebugRunGulp" BeforeTargets="DebugEnsureNodeEnv" Condition=" '$(Configuration)' == 'Debug' And Exists('$(SolutionDir)node_modules') ">
45-
<Exec WorkingDirectory="$(SolutionDir)" Command="npm run gulp:layout" />
46-
</Target>
47-
48-
<Target Name="PublishRunGulp" AfterTargets="ComputeFilesToPublish">
49-
<Exec WorkingDirectory="$(SolutionDir)" Command="npm install" />
50-
<Exec WorkingDirectory="$(SolutionDir)" Command="npm run gulp:layout" />
51-
</Target>
35+
<ItemGroup>
36+
<ProjectReference Include="..\..\..\..\ant-design-blazor\components\AntDesign.csproj" />
37+
</ItemGroup>
5238

5339
<ItemGroup>
5440
<Content Update="**\*.razor">
Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,58 @@
11
@namespace AntDesign.ProLayout
2+
@using Microsoft.AspNetCore.Components.Routing
23
@inherits AntProComponentBase
34

4-
<Menu
5-
Mode="Mode"
6-
DefaultOpenKeys="OpenKeys"
7-
Theme="NavTheme"
8-
Style="@Style"
9-
Accordion="@Accordion"
10-
Class="@ClassMapper.Class"
11-
OnOpenChange="SetOpenKeys">
12-
@menuItemTemplate((MenuData, false))
5+
<Menu Mode="Mode"
6+
DefaultOpenKeys="OpenKeys"
7+
Theme="NavTheme"
8+
Style="@Style"
9+
Accordion="@Accordion"
10+
Class="@ClassMapper.Class"
11+
OnOpenChange="SetOpenKeys">
12+
@menuItemTemplate(MenuData, false)
1313
</Menu>
1414

1515
@code
1616
{
17-
static readonly RenderFragment<MenuDataItem> title= menuItem => @<span>
18-
@if (!string.IsNullOrEmpty(menuItem.Icon))
19-
{
20-
<Icon Type="@menuItem.Icon" Theme="outline" />
21-
}
22-
<span>@menuItem.Name</span>
23-
</span>;
17+
RenderFragment title(MenuDataItem menuItem) {
18+
19+
return @<span>
20+
@if (!string.IsNullOrEmpty(menuItem.Icon))
21+
{
22+
<Icon Type="@menuItem.Icon" Theme="outline" />
23+
}
24+
<span>@menuItem.Name</span>
25+
</span>
26+
;
27+
}
28+
29+
RenderFragment menuItemTemplate(MenuDataItem[] items, bool isChildren)
30+
{
31+
@if (items == null)
32+
{
33+
return builder => { };
34+
}
2435

25-
static readonly RenderFragment<(MenuDataItem[] items, bool isChildren)> menuItemTemplate = context =>
26-
@<Template>
27-
@if (context.items != null)
36+
return builder =>
37+
{
38+
39+
@foreach (var menuItem in items)
2840
{
29-
@foreach (var menuItem in context.items)
41+
if (menuItem.Children != null && !menuItem.HideChildrenInMenu)
42+
{
43+
builder.AddContent(1,
44+
@<SubMenu TitleTemplate="@title(menuItem)" Key="@menuItem.Key">
45+
@menuItemTemplate(menuItem.Children, true)
46+
</SubMenu>);
47+
}
48+
else if (!menuItem.HideInMenu)
3049
{
31-
if (menuItem.Children != null && !menuItem.HideChildrenInMenu)
32-
{
33-
<SubMenu TitleTemplate="@title(menuItem)" Key="@menuItem.Key">
34-
@menuItemTemplate((menuItem.Children, true))
35-
</SubMenu>
36-
}
37-
else if (!menuItem.HideInMenu)
38-
{
39-
<MenuItem Key="@menuItem.Key" RouterLink="@menuItem.Path" RouterMatch="@menuItem.Match">@title(menuItem)</MenuItem>
40-
}
50+
builder.AddContent(1,
51+
@<MenuItem Key="@menuItem.Key" RouterLink="@menuItem.Path" RouterMatch="@menuItem.Match">
52+
@title(menuItem)
53+
</MenuItem>);
4154
}
4255
}
43-
</Template>;
56+
};
57+
}
4458
}

src/layout/src/SiderMenu/MenuDataItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ public class MenuDataItem
1414
public string Key { get; set; }
1515
public string Path { get; set; }
1616
public string[] ParentKeys { get; set; }
17-
public NavLinkMatch Match { get; set; }
17+
public NavLinkMatch Match { get; set; } = NavLinkMatch.All;
1818
}
1919
}

0 commit comments

Comments
 (0)