【发布时间】:2022-07-28 01:28:26
【问题描述】:
购物 黎明2.0主题 RE:倒数计时器
我正在尝试使用 Shopify 代码框架。
我想制作自己的倒数计时器并开始,我复制了部分中的公告条码并将其命名为倒数。
我还复制了公告栏 css。
我已将所有公告重命名为倒计时 - 以免在 css 和 html 类中混淆。
我已经让计数计时器在定制器中显示为可选部分,但是当它处于活动状态时,它不会显示。
[定制器和倒数计时器出现的屏幕截图][1]
我注意到它没有与标题/公告栏类似的图标。
我做错了什么?
这是我当前的代码:
{%- case block.type -%}
{%- when 'countdown' -%}
<div class="countdown-bar color-{{ block.settings.color_scheme }} gradient" role="region" aria-label="{{ 'sections.header.countdown' | t }}" {{ block.shopify_attributes }}>
{%- if block.settings.text != blank -%}
{%- if block.settings.link != blank -%}
<a href="{{ block.settings.link }}" class="countdown-bar__link link link--text focus-inset animate-arrow">
{%- endif -%}
<p class="countdown-bar__message h5">
{{ block.settings.text | escape }}
{%- if block.settings.link != blank -%}
{% render 'icon-arrow' %}
{%- endif -%}
</p>
{%- if block.settings.link != blank -%}
</a>
{%- endif -%}
{%- endif -%}
</div>
{%- endcase -%}
{%- endfor -%}
{% schema %}
{
"name": "Countdown Timer",
"max_blocks": 2,
"blocks": [
{
"type": "announcement",
"name": "Countdown Timer",
"settings": [
{
"type": "text",
"id": "text",
"default": "We must edit the code to configure the timer",
"label": "t:sections.countdown-bar.blocks.countdown.settings.text.label"
},
{
"type": "select",
"id": "color_scheme",
"options": [
{
"value": "background-1",
"label": "t:sections.countdown-bar.blocks.countdown.settings.color_scheme.options__1.label"
},
{
"value": "background-2",
"label": "t:sections.countdown-bar.blocks.countdown.settings.color_scheme.options__2.label"
},
{
"value": "inverse",
"label": "t:sections.countdown-bar.blocks.countdown.settings.color_scheme.options__3.label"
},
{
"value": "accent-1",
"label": "t:sections.countdown-bar.blocks.countdown.settings.color_scheme.options__4.label"
},
{
"value": "accent-2",
"label": "t:sections.countdown-bar.blocks.countdown.settings.color_scheme.options__5.label"
}
],
"default": "accent-1",
"label": "t:sections.countdown-bar.blocks.countdown.settings.color_scheme.label"
},
{
"type": "url",
"id": "link",
"label": "t:sections.countdown-bar.blocks.countdown.settings.link.label"
}
]
}
],
"default": {
"blocks": [
{
"type": "announcement"
}
]
}
}
{% endschema %}```
[1]: https://i.stack.imgur.com/HDlMz.png
【问题讨论】: