如何更改液体中可折叠内容菜单中各行的背景颜色?

How to change the background color for individual rows in a collapsible content menu in liquid?

我只是习惯了液体,我这辈子都想不出如何输入代码来为手风琴式可折叠菜单中的每一行分配颜色。

我已经成功地为主题编辑器制作了架构,但无法让它控制液体。

我认为它属于我在下面写的 [HERE] 但不知道的地方。如果有人可以提供帮助,我将不胜感激!

代码如下:

      {% endif %}
      <div class="grid__item">
        {%- for block in section.blocks -%}  

[这里?? ]

        <div class="accordion{% if section.settings.layout == 'row' %} content-container color-{{ section.settings.row.color }} gradient{% endif %}" {{ block.shopify_attributes }}>
            <details id="Details-{{ block.id }}-{{ section.id }}"{% if section.settings.open_first_collapsible_row and forloop.first %} open{% endif %}>
              <summary id="Summary-{{ block.id }}-{{ section.id }}">
                {% render 'icon-accordion', icon: block.settings.icon %}
                <h3 class="accordion__title h4">
                  {{ block.settings.heading | default: block.settings.page.title }}
                </h3>
                {% render 'icon-caret' %}
              </summary>
              <div class="accordion__content rte" id="CollapsibleAccordion-{{ block.id }}-{{ section.id }}" role="region" aria-labelledby="Summary-{{ block.id }}-{{ section.id }}">
                {{ block.settings.row_content }}
                {{ block.settings.page.content }}
              </div>
            </details>
          </div>
        {%- endfor -%}
      </div>

我创建的架构:

{ “类型”:“颜色”, "id": "row_color", “默认”:“#FFFFFF”, "label": "行颜色", "info": "改变这一行的颜色" },

您可以像这样访问节块架构数据:

{{ block.settings.id }}

id 是您为特定设置定义的 ID,在本例中为 row_color.

结论:

{{ block.settings.row_color }} // Returns either your default value `#ffffff` or the one selected in the customizer