是否有一种方法可以为Razor组件指定目标元素,类似于将HtmlTargetElement用于Tag Helpers的方法?
@inherits NavigationBase
<ul class="@Class">
@foreach (INavigation nav in RazorManager.Navigations[Group])
{
<li>
<a href="@nav.Route">@nav.Text</a>
</li>
}
</ul>
当前用法:
<Navigation group="Main" class="nav navbar-nav" />
所需用法:
<navigation group="Main" class="nav navbar-nav">
有了标签助手,就很简单:
[HtmlTargetElement("navigation", TagStructure = TagStructure.WithoutEndTag)]