假设custom_fields包含此数据,我想找出它是否具有名称为“ hide_options”的项目/对象。我想将此传递给组件。
[
{"id":"12","name":"hide_options","value":"true"},
{"id":"13","name":"state","value":"colorado"},
{"id":"14","name":"city","value":"colorado, springs"}
]
我想出的最接近的是:
模板\组件\产品\ product-view.html
{{> components/products/conditionallyVisibile
hideOptions=(occurrences (join (pluck product.custom_fields "name") ",") "hide_options")
}}
components / products / conditionallyVisibile.html
<div>
hideOptions {{ hideOptions }}
</div>
我是否缺少一个更容易使用的Array或Collection帮助器?大多数Array / Collection帮助器都是块帮助器。