如何从{%raw%}中传递捕获的值(句柄)以从液体中获得shopify的对象?

发布于 2025-02-11 11:48:16 字数 643 浏览 2 评论 0原文

我正在使用VUE3和Liquid进行某些Shopify主题开发。在我的情况下,Vue组件有一个值,我想使用此值将Shopify对象在液体文件中获取。

<div v-for="handle in featuredHandlesArray" :key="handle" >            
  {% capture article_liquid %}
    {% raw %}{{ handle }}{% endraw %}
  {% endcapture %}

  {% assign article_obj = articles[article_liquid] %}
</div>

在这里,我从VUE组件中获得了“特色Handlesarray”,并使用V-For循环。没有问题。如果我在循环中呼应了这些“句柄”值,它将打印我的相关句柄。即使我回声捕获了“ {%endcapture%}”标签下方的“ atration_liquid”变量,它也会打印。但是,当我尝试通过该处理方式从Shopify获取文章对象时,没什么。它的意思是“文章[atraty_liquid]”不起作用。我只想通过传递句柄从shopify获取该文章对象,并将该对象分配到诸如“ aptical_obj”之类的变量中。

如果有人遇到了这种问题,请给我一个支持。或任何建议将不胜感激。谢谢!

I'm using vue3 and liquid for some Shopify theme developments.In my case, there is a value from vue component and I want to use this value to get a shopify object within liquid file.

<div v-for="handle in featuredHandlesArray" :key="handle" >            
  {% capture article_liquid %}
    {% raw %}{{ handle }}{% endraw %}
  {% endcapture %}

  {% assign article_obj = articles[article_liquid] %}
</div>

Here I'm getting above 'featuredHandlesArray' from vue component and looping with a v-for. There's no issue with it. If I echo these 'handle' value in the loop, it prints my relevant handle. Even when I echo captured 'article_liquid' variable below the '{% endcapture %}' tag, it prints too. But when I try to pass that handle to get the article object from shopify, it's nothing. It means 'articles[article_liquid]' is not working. I just want to get that article object from shopify by passing handle and assign that object into a variable like 'article_obj'.

If anyone experienced this kind of issue, please give me a support. Or any suggestion will be very appreciated. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文