问题
How can I add a class and/or ID to be output for a Content Menu Item with Orchard 1.5?
回答1:
Go to Content/Content Parts, edit the Menu content part and add a "CssClass" text field. Then, override the template for menuitem.cshtml and right after the var tag =
line, add:
if (Model.CssClass != null) {
tag.AddCssClass(Model.ContentItem.Menu.CssClass.Value);
}
That should do the trick.
来源:https://stackoverflow.com/questions/12109728/orchard-1-5-add-class-or-id-in-contentmenuitem