Collections
.Children 子节点
1 <ul> 2 @foreach(var item in Model.Content.Children) 3 { 4 <li><a href="@item.Url">@item.Name</a></li> 5 } 6 </ul>
.Ancestors 返回当前页面的所有祖先(父页面,祖父母等)
1 <ul> 2 @*Order items by their Level*@ 3 @foreach(var item in Model.Content.Ancestors().OrderBy(x => x.Level)) 4 { 5 <li><a href="@item.Url">@item.Name</a></li> 6 } 7 </ul>
时间: 2024-11-13 21:56:47