Ada*_*cot 1 liquid shopify shopify-template
我可以使用以下代码调用产品图像的 URL
{{ product | img_url: "medium" }}
Run Code Online (Sandbox Code Playgroud)
这个输出:
//cdn.shopify.com/s/files/1/0087/0462/products/shirt14_medium.jpeg?v=1309278311
Run Code Online (Sandbox Code Playgroud)
<img>然而,当我在这样的标签中使用这种液体代码时
<img src="{{ product | img_url: "medium" }}" />
Run Code Online (Sandbox Code Playgroud)
输出是:
<img src="" />
Run Code Online (Sandbox Code Playgroud)
如何正确展示产品图片?
它应该是:
{{ product.featured_image | img_url: '600x600' | img_tag: product.featured_image.alt }}
与以下相同:
<img src="{{ product.featured_image | img_url: '600x600' }}" alt="{{product.featured_image.alt}}" />
或者
{{ product.images[0]| img_url: '600x600' | img_tag: product.images[0].alt }}
与以下相同:
<img src="{{ product.images[0] | img_url: '600x600' }}" alt="{{product.images[0].alt}}" />
他们两个都会工作。
不要使用已弃用的“中”,有关更多信息,请参阅此处: https: //help.shopify.com/en/themes/liquid/filters/deprecated-filters#named-size-parameters
| 归档时间: |
|
| 查看次数: |
15604 次 |
| 最近记录: |