剃刀组件是否等同于HtmlTargetElementAttribute?

时间:2019-09-28 20:57:57

标签: c# razor blazor blazor-server-side .net-core-3.0

是否有一种方法可以为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)]

0 个答案:

没有答案