gpt4 book ai didi

javascript - Handlebars.js - 使用变量键访问对象值

转载 作者:行者123 更新时间:2023-12-03 12:46:34 26 4
gpt4 key购买 nike

寻找一种方法来实现这一点:

{{#each someArray}}
{{../otherObject.[this]}}
{{/each}}

如何评估 this 的值然后将其作为我的对象 otherObject 的键引用?

最佳答案

查找:https://handlebarsjs.com/guide/builtin-helpers.html#lookup

{{#each someArray}}
{{lookup ../otherObject this}}
{{/each}}

关于javascript - Handlebars.js - 使用变量键访问对象值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19646244/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com