有没有办法让 TagHelper 呈现另一个 TagHelper?
示例 TagHelpers;
public class OuterTagHelper : TagHelper
{
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "";
output.Content.SetContent("Hello <inner></inner>");
}
}
public class InnerTagHelper : TagHelper
{
public override void Process(TagHelperContext context, TagHelperOutput output)
{
output.TagName = "";
output.Content.SetContent("World!");
}
}
示例视图;
<outer></outer>
预期结果;
Hello World!
我知道我可能应该改用 ViewComponent,但是是否有可能实现上述预期行为?