巴克励步
发布于:2025-01-02
== | 相等 |
!= | 不相等 |
> | 大于 |
< | 小于 |
>= | 大于或等于 |
<= | 小于或等于 |
or | 逻辑或 |
and | 逻辑与 |
{% if product.title == "Awesome Shoes" %}
These shoes are awesome!
{% endif %}
{% if product.type == "Shirt" or product.type == "Shoes" %}
This is a shirt or a pair of shoes.
{% endif %}
contains 用于检查在一个字符串中是否存在某个子串。
{% if product.title contains 'Pack' %}
This product's title contains the word Pack.
{% endif %}
contains 还可以用于检查一个字符串数组中是否存在某个字符串。
{% if product.tags contains 'Hello' %}
This product has been tagged with 'Hello'.
{% endif %}
contains 只能用于搜索字符串。你不能将其用于从一个对象数组中检查是否存在某个对象。