【发布时间】:2019-12-06 08:59:16
【问题描述】:
我正在使用 Liquid 为 Shopify 主题制作自定义部分,/sections/mytest.liquid 的代码如下。
我希望看到带有红色边框的部分,并且我希望在浏览器控制台中看到部分 ID。
它不起作用,因为 shopify 忽略了我的样式表。它总是说缺少部分 ID。我做错了什么?
<div id="fish1">
Hello this is the threshold -- {{ section.settings.threshold }} --
</div>
{% javascript %}
console.log('THE SECTION ID IS ' + (section ? section.id : 'MISSING'));
{% endjavascript %}
{% stylesheet %}
#fish1 {
border: 1px solid red;
background-color: cyan;
}
{% endstylesheet %}
{% schema %}
{
"name": "test Header",
"settings": [
{
"type": "range",
"id": "threshold",
"min": 300, "max": 1000, "step": 10, "unit": "px",
"label": "Threshold",
"default": 760
}
],
"presets": [
{
"category": "My Stuff",
"name": "My Test"
}
]
}
{% endschema %}
【问题讨论】:
标签: shopify liquid shopify-template