<!-- Index.cshtml -->
<my-first>
This is the original Inner HTML from the *.cshtml file.
</my-first>
// MyFirstTagHelper.cs > ProcessAsync
var childContent = await output.GetChildContentAsync();
var innerHtml = childContent.GetContent();
invoke a view component as a tag helper
<vc:my-first>
This is the original Inner HTML from the *.cshtml file.
</vc:my-first>
// MyFirstViewComponent.cs > InvokeAsync()
var innerHtml = DoMagic();
进一步思考:
有些人可能会说,“那为什么不使用标签助手呢?”好吧,我们希望将视图与标记助手相关联,而标记助手不支持视图;相反,标记助手要求我们以编程方式构建所有HTML。