【发布时间】:2021-12-07 04:16:45
【问题描述】:
我使用 Section Rendering API 来呈现部分的内容,但问题是它无法呈现该部分拥有的块。
例子:
<div class="section-blocks">
{%- for block in section.blocks -%}
{%- case block.type -%}
{%- when 'title' -%}
<span>This is title</span>
{%- when 'text' -%}
<span>This is text</span>
{%- endcase -%}
{%- endfor -%}
</div>
{% schema %}
{
"name": "Demo section",
"tag": "section",
"class": "demo-section",
"settings": [],
"blocks": [
{
"type": "title",
"name": "the_title",
"settings": []
},
{
"type": "text",
"name": "the_text",
"settings": []
}
]
}
{% endschema %}
一般会显示如下内容:
<div class="section-blocks">
<span>This is title</span>
<span>This is text</span>
</div>
但是使用Section Rendering API时,内容只有:
<div class="section-blocks"></div>
Section Rendering API 不支持渲染块? 还是我错过了文档或教程?
谁能给我解释一下,谢谢!
【问题讨论】: