我正在编写一个Blazor站点,使用Content作为CMS.我有两个围绕Rich Text文档类型的需求.
-
我需要循环整个文档正文并分离标题部分,然后将值呈现到列表中
-
我需要获取文档类型中的第一个段落元素并呈现该元素的值.
我正在使用以下代码: case 1:
foreach (IContent node in ccContent.Items.bodyText.Content)
{
switch (node)
{
case Heading2 h:
--------> h.Content.Value can be seen in a breakpoint, but not
--------> available to render in code
break;
default:
break;
}
}
case 2:
foreach (var article in articles)
{
foreach (IContent node in article.response.Content)
{
switch (node)
{
case Paragraph p:
IContent content = p.Content.FirstOrDefault();
--------> content.Value can be seen in a breakpoint, but not
--------> available to render in code?
break;
}
}
}