【问题标题】:Add Dynamic content in {% schema %} section for Shopify Theme在 Shopify 主题的 {% schema %} 部分添加动态内容
【发布时间】:2018-10-12 15:56:43
【问题描述】:

根据Shopify主题教程https://help.shopify.com/themes/development/theme-editor/settings-schema

文件,我们可以通过 set {% schema %} 部分定义主题设置,如下例:

{% schema %}
{
  "name": "Line",
  "class": "index-section",
  "settings": [
    {
      "type": "radio",
      "id": "small_line",
      "label": "Correct Gap",
      "options": [
        {
          "value": "none",
          "label": "None"
        },
        {
          "value": "gap1",
          "label": "Different Gap"
        }
      ],
      "default": "none"
    }
  ],
  "presets": [
    {
      "name": "Line",
      "category": "Design",
      "settings": {
      }
    }
  ]
}
{% endschema %}

我的问题是,我们是否可以在架构部分中将此设置设置为动态的,例如在上面的示例中将“small_line”选项定义为变量,类似于以下内容

{% schema %}
{
  "name": "Line",
  "class": "index-section",
  "settings": [
    {
      "type": "radio",
      "id": "small_line",
      "label": "Correct Gap",
      "options": MY_OPTIONS_VAR,
      "default": "none"
    }
  ],
  "presets": [
    {
      "name": "Line",
      "category": "Design",
      "settings": {
      }
    }
  ]
}
{% endschema %}

【问题讨论】:

    标签: shopify liquid shopify-template


    【解决方案1】:

    不,您不能在架构对象中添加任何流动代码。

    这里的所有内容都需要作为静态信息输入。

    【讨论】:

      猜你喜欢
      • 2021-01-12
      • 1970-01-01
      • 2022-01-20
      • 2019-08-10
      • 2017-05-31
      • 2019-12-05
      • 2015-08-04
      • 1970-01-01
      • 2012-09-05
      相关资源
      最近更新 更多