你可以复制以下 yaml 代码,并将其用作示例页面的页眉。
你可以在 github 问题中粘贴此 URL,以便在提交错误或问题时分享你的设置
Handlebars
模板
{{#each persons as | person |}}
{{name}} lives in {{#with (lookup ../cities [resident-in])~}}
{{name}} ({{country}})
{{/with}}
{{/each}}
准备脚本
// Handlebars.registerHelper('loud', function(string) {
// return string.toUpperCase()
// });
输入
{
persons: [
{
name: "Nils",
"resident-in": "darmstadt",
},
{
name: "Yehuda",
"resident-in": "san-francisco",
},
],
cities: {
darmstadt: {
name: "Darmstadt",
country: "Germany",
},
"san-francisco": {
name: "San Francisco",
country: "USA",
},
},
}
输出
Nils lives in Darmstadt (Germany)
Yehuda lives in San Francisco (USA)