using Microsoft.AspNetCore.Razor.TagHelpers; namespace Microsoft.Extensions.TagHelpers { public class EmailTagHelper : TagHelper { public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "a"; } } }
_ViewImports.cshtml 中:
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Microsoft.Extensions.TagHelpers
调用页面:
<email>Jack Simple</email>
结果生成页还是:
<email>Jack Simple</email>
初次使用,不知道是哪里的原因?