view-components

In a view component invoked as a tag helper, how can we access the inner HTML?

China☆狼群 提交于 2019-12-24 08:57:22
问题 In tag helpers, we can access the tags inner HTML. <!-- 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(); If we invoke a view component as a tag helper, how can we access the inner HTML? <vc:my-first> This is the original Inner HTML from the *.cshtml file. </vc:my-first> // MyFirstViewComponent.cs > InvokeAsync()