重构代码将菜单生成li方法统一到SubMenu部分视图中

This commit is contained in:
Argo-Lenovo 2016-12-22 21:53:50 +08:00
parent 80200e60fa
commit bf7a7cafeb
4 changed files with 11 additions and 14 deletions

View File

@ -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>

View File

@ -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-->

View File

@ -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>

View File

@ -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>