例如:我希望我的标签按原样呈现。相反,它是用它自动生成所有其他好东西。如何为该特定标签关闭Tag Helpers?
答案 0 :(得分:5)
您可以在标签名称之前添加!
,以防止标签助手执行:
<!form method="post">
<button type="submit">Submit</button>
</!form>
答案 1 :(得分:1)
您可以通过引用其完整类型名称来删除特定TagHelper影响视图,即:
@removeTagHelper The.Full.TypeName.Of.The.TagHelper, TheAssemblyNameTheTagHelperExistsIn
或者,如果要禁用程序集中的所有TagHelper:
@removeTagHelper *, TheAssemblyNameTheTagHelperExistsIn
所以要完整的循环,如果你想禁用所有默认的MVC TagHelpers,你可以包括两行:
@* This nukes ~/ resolution and ITagHelperComponents (things running on body/head), this is an auto-inclusion in every view *@
@removeTagHelper *, Microsoft.AspNetCore.Mvc.Razor
@* These TagHelpers are typically included via a _ViewImports.cshtml. This nukes all of the MVC TagHelpers (environment, input with asp-for, etc.)*@
@removeTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers