为什么要加入数组工作,但不能访问单个元素?
我刚刚开始努力自定义我的Shopify模板,但是我遇到了一个基本问题,文档无济于事。
<script>console.log("_{{ item.properties | join: ", " }}_");</script>
// prints "_foo1, foo2_"
<script>console.log("_{{ item.properties[0] }}_");</script>
// prints "__"
<script>console.log("_{{ item.properties }}_");</script>
// prints "_EscapedHashDrop_"
谢谢!
I've just started working on customizing my Shopify template, but I've ran into a basic issue, where the docs didn't help.
<script>console.log("_{{ item.properties | join: ", " }}_");</script>
// prints "_foo1, foo2_"
<script>console.log("_{{ item.properties[0] }}_");</script>
// prints "__"
<script>console.log("_{{ item.properties }}_");</script>
// prints "_EscapedHashDrop_"
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将在第一个控制台中获得字符串中的值,并尝试将值作为第二控制台中的数组获取,因此不可能
通过使用.split()函数在数组中转换字符串值。
尝试此代码,它将根据您提供结果。
you are getting value in string in first console and try to fetch value as a array in second console so it's not possible
you have to convert your string value in array by using .split() function.
Try this code it will give result according to you.