错误:标记'schema'中的JSON无效(Shopify Slick Sider)

时间:2017-09-23 19:46:03

标签: json shopify

我正在使用Shopify新功能部分构建一个光滑的滑块。所有想要的是添加左右箭头的图像。

使用标题,描述和按钮,用户可以更改并添加链接到Carousel顶部的所有内容,并更改所有内容,点击底部的箭头或幽灵按钮

这是一个ScreenShot。

enter image description here

{% if section.blocks.size > 0 %}
<!-- Slick Slider Wrapper -->
<div class="carousel-wrapper" style="background-color: red;">
    <div class="carousel-info">
      <!-- Title Slider Wrapper -->
      <h3>{{ section.settings.carousel_title }}</h3>
      <!-- Description Wrapper -->
      <p>{{ section.settings.carousel_product_description }}</p>
      <!-- Button Wrapper -->
      <button>{{ section.settings.carousel_button_title }}</button>
    </div>

    <!-- Slick Slider -->
    <div id="carousel-{{ section.id }}" class="carousel" data-slick='{"autoplay": {{ section.settings.carousel_autoplay }}}'>
    {% for block in section.blocks %}
        <div class="carousel-slide--{{ block.id }}" {{ block.shopify_attributes }} style="width:240px">
            {% if block.settings.carousel_image != blank %}
                    <img class="carousel_image--{{ block.id }}" src="{{ block.settings.carousel_image | img_url: '240x' }}" style="max-width:240px;display:inline-block;padding:40px">
            {% endif %}
        </div>
    {% endfor %}
    </div>
    <!-- ended of Slick Slider -->
  </div>

  </div>
  {% endif %}

  {% if section.blocks.size == 0 %}
    <div class="placeholder-noblocks">
        {{ 'homepage.onboarding.no_content' | t }}
    </div>
  {% endif %}
  <!-- Slick Slider Wrapper -->

{% schema %}
{
  "name": "Carousel",
  "max_blocks": 8,
  "settings": [
    {
       "type":"header",
       "content":"Carousel option"
    },
    {
       "type":"text",
       "id":"carousel_title",
       "label":"Carousel title",
       "default":"Carousel main title"
    },
      "type": "text",
      "id": "carousel_title",
      "label":"Carousel title",
      "default":"Carousel main title"
    },
    {
      "type" "text",
      "id": "carousel_product_description",
      "label": "Carousel Description",
      "default: Carousel Main Description"
    },
    {
  "type": "url",
  "id": "carousel_link",
  "label": "Carousel title link"
    },
    {
       "type":"header",
       "content":"In depth carousel option"
    },
    {
      "type": "checkbox",
      "id": "carousel_autoplay",
      "label": "Auto-rotate slides",
      "default": false
    },
    {
       "type":"color",
       "id":"carousel_bg",
       "label":"Carousel background",
       "default":"#fff"
    }
  ],
  "blocks": [
    {
      "type": "image",
      "name": "Image slide",
      "settings": [
        {
          "type": "image_picker",
          "id": "carousel_image",
          "label": "Image"
        },
        {
          "type": "url",
          "id": "slide_link",
          "label": "Slide link"
        }
      ]
    }
  ],
  "presets": [{
    "name": "Carousel",
    "category": "Image",
    "settings": {
      "carousel_autoplay": false
    },
    "blocks": [
      {
        "type": "image"
      },
      {
        "type": "image"
      },
      {
        "type": "image"
      },
      {
        "type": "image"
      },
      {
        "type": "image"
      },
      {
        "type": "image"
      }
    ]
  }]
}
{% endschema %}

1 个答案:

答案 0 :(得分:0)

你在单词类型之前缺少一个开放的大括号,在第二个类型对象之后缺少一个冒号。

     {
        "name": "Carousel",
        "max_blocks": 8,
        "settings": [
        {
           "type":"header",
           "content":"Carousel option"
        },
        {
           "type":"text",
           "id":"carousel_title",
           "label":"Carousel title",
           "default":"Carousel main title"
        },
        {
          "type": "text",
          "id": "carousel_title",
          "label":"Carousel title",
          "default":"Carousel main title"
        },
        {
          "type": "text",
          "id": "carousel_product_description",
          "label": "Carousel Description",
          "default: Carousel Main Description"
        },
        {
          "type": "url",
          "id": "carousel_link",
          "label": "Carousel title link"
        },
        {
           "type":"header",
           "content":"In depth carousel option"
        },
        {
          "type": "checkbox",
          "id": "carousel_autoplay",
          "label": "Auto-rotate slides",
          "default": false
        },
        {
           "type":"color",
           "id":"carousel_bg",
           "label":"Carousel background",
           "default":"#fff"
        }
      ],
      "blocks": [
        {
          "type": "image",
          "name": "Image slide",
          "settings": [
            {
              "type": "image_picker",
              "id": "carousel_image",
              "label": "Image"
            },
            {
              "type": "url",
              "id": "slide_link",
              "label": "Slide link"
            }
          ]
        }
      ],
      "presets": [{
        "name": "Carousel",
        "category": "Image",
        "settings": {
          "carousel_autoplay": false
        },
        "blocks": [
          {
            "type": "image"
          },
          {
            "type": "image"
          },
          {
            "type": "image"
          },
          {
            "type": "image"
          },
          {
            "type": "image"
          },
          {
            "type": "image"
          }
        ]
      }]
    }