首页 > 解决方案 > “选择”块属性无效

问题描述

我一直很享受使用 Shopify 开发人员和员工提供的 YouTube 视频学习 Liquid,但我遇到了一个相当奇怪的问题。据我了解,类型是我确定的任意文本字符串。我正在关注的 YouTube 视频使用“选择”类型在预设部分创建多个带有标注的块。但是,调试器拒绝将此术语作为“无效 ID”。

我的架构如下:

{% schema %}
{
  "name": "Footer Section",
  "max_blocks": 3,
  "settings": [
    {
        "id": "footer-section-title",
        "type": "text",
        "label": "Footer Title",
        "default": "Footer"
    }
  ],
  "blocks": [
    {
      "type": "select",
      "name": "select",
      "settings:": [
        {
          "id": "footer-linktext",
          "type": "text",
          "label": "Link Text",
          "default": "Click Here"
        },
        {
          "id": "footer-linkurl",
          "type": "url",
          "label": "Link URL",
          "default": "Click Here"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "Footer Blocks",
      "category": "Footer",
        "blocks": [
            {
                "type": "select"
            },
        {
                "type": "select"
            }
        ]
    }
  ]
}
{% endschema %}

这与 2017 年视频中出现的几乎相同。情况发生了变化吗?我尝试了其他条款,但都被拒绝了。

先感谢您!

标签: schemashopifyliquid

解决方案


你在字符串中"settings:": [有额外的。:这就是引发错误的原因。

将其更改为仅"settings",您应该没有问题。


推荐阅读