File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed
example/AntDesign.ProLayout.Wasm/Shared Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 5050 protected override async Task OnInitializedAsync ()
5151 {
5252 await base .OnInitializedAsync ();
53- var data = await HttpClient .GetFromJsonAsync <MenuDataItem []>(" data/menu.json" );
54- MenuData = data ;
53+ var data = await HttpClient .GetFromJsonAsync <List <MenuDataItem >>(" data/menu.json" );
54+ data .Insert (0 , new MenuDataItem
55+ {
56+ TitleTemplate = @< span >< Icon Type = " user" >< / Icon > Custom Menu < / span > ,
57+ });
58+ MenuData = data .ToArray ();
5559 }
5660}
Original file line number Diff line number Diff line change 1414
1515@code
1616{
17- RenderFragment title (MenuDataItem menuItem ) {
18-
17+ RenderFragment title (MenuDataItem menuItem )
18+ {
19+ if (menuItem .TitleTemplate != null )
20+ {
21+ return menuItem .TitleTemplate ;
22+ }
1923 return @< span >
2024 @if (! string .IsNullOrEmpty (menuItem .Icon ))
2125 {
2630 ;
2731 }
2832
29- RenderFragment menuItemTemplate (MenuDataItem [] items , bool isChildren )
33+ RenderFragment menuItemTemplate (IEnumerable < MenuDataItem > items , bool isChildren )
3034 {
3135 @if (items == null )
3236 {
Original file line number Diff line number Diff line change 1- using Microsoft . AspNetCore . Components . Routing ;
1+ using Microsoft . AspNetCore . Components ;
2+ using Microsoft . AspNetCore . Components . Routing ;
23
34namespace AntDesign . ProLayout
45{
@@ -15,5 +16,6 @@ public class MenuDataItem
1516 public string Path { get ; set ; }
1617 public string [ ] ParentKeys { get ; set ; }
1718 public NavLinkMatch Match { get ; set ; } = NavLinkMatch . All ;
19+ public RenderFragment TitleTemplate { get ; set ; }
1820 }
1921}
You can’t perform that action at this time.
0 commit comments