重构代码将菜单生成li方法统一到SubMenu部分视图中
This commit is contained in:
parent
80200e60fa
commit
bf7a7cafeb
|
@ -321,6 +321,7 @@
|
|||
<Content Include="Views\Admin\Mobile.cshtml" />
|
||||
<Content Include="Views\Shared\_Mobile.cshtml" />
|
||||
<Content Include="Views\Home\Mobile.cshtml" />
|
||||
<Content Include="Views\Shared\SubMenu.cshtml" />
|
||||
<None Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</None>
|
||||
|
|
|
@ -5,13 +5,7 @@
|
|||
<ul class="sidebar-menu" id="nav-accordion">
|
||||
@foreach (var menu in Model.Navigations)
|
||||
{
|
||||
<li class="sub-menu">
|
||||
<a href="@Url.Content(menu.Url)" class="@menu.Active"><i class="@menu.Icon"></i>@menu.Name</a>
|
||||
@if (menu.Menus.Count() > 0)
|
||||
{
|
||||
@Html.Partial("SubNavigation", menu.Menus)
|
||||
}
|
||||
</li>
|
||||
@Html.Partial("SubMenu", menu)
|
||||
}
|
||||
</ul>
|
||||
<!-- sidebar menu end-->
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
@model Menu
|
||||
<li class="sub-menu">
|
||||
<a href="@Url.Content(Model.Url)" class="@Model.Active" target="@Model.Target"><i class="@Model.Icon"></i>@Model.Name</a>
|
||||
@if (Model.Menus.Count() > 0)
|
||||
{
|
||||
@Html.Partial("SubNavigation", Model.Menus)
|
||||
}
|
||||
</li>
|
|
@ -2,12 +2,6 @@
|
|||
<ul class="sub">
|
||||
@foreach (var menu in Model)
|
||||
{
|
||||
<li class="sub-menu">
|
||||
<a href="@Url.Content(menu.Url)" class="@menu.Active"><i class="@menu.Icon"></i>@menu.Name</a>
|
||||
@if (menu.Menus.Count() > 0)
|
||||
{
|
||||
@Html.Partial("SubNavigation", menu.Menus)
|
||||
}
|
||||
</li>
|
||||
@Html.Partial("SubMenu", menu)
|
||||
}
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue