0

我正在构建 Shopify 主题并添加光滑的滑块插件http://kenwheeler.github.io/slick/

我已经创建了用于设置内部的模式 json 和 Slider 的代码,但无法开始工作。我收到一条错误消息:

15:48:35 [开发] 对主机 unique-legacy.myshopify.com 上的sections/slick-silder.liquid 进行资产更新
状态:422 无法处理的实体错误:标签“架构”中的无效 JSON 15:48:58 [开发]资产配置/settings_data.json 根据忽略模式过滤

我的导师告诉我,JSON 模式并没有什么问题,但是创建的光滑滑块会拥有一些东西,但仍然无法理解正在发生的事情。

解释代码:试图创建的是一个带有光滑的自定义滑块,并以它在新部分选项中的方式创建。

因此,使用该主题的用户可以将滑块放在任何页面上并移动到底部或顶部。

有人可以解释一下吗

{% 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">
    {% 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 Images",
       "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 %}
4

1 回答 1

0

您的 JSON 架构中有错误。

   {
     "type": "text",
     "id": "carousel_product_description",
     "label": "Carousel Description",
     "default: Carousel Main Description"
   },

没有收盘,"default没有开盘"Carousel Main Description

在此处验证您的 JSON:https ://jsonlint.com/您也会看到它。

于 2017-09-27T05:16:28.340 回答