【发布时间】:2018-06-13 22:49:44
【问题描述】:
如果我的父上下文可以访问属性(索引),我可以将它传递给子表达式吗?我似乎无法让它工作。我已经确认 with 块与传递给它的静态值一起工作 (1)
// Parent template
-----------------------------------------------------------------------------
{#child {{../report.ResourceName}}--{{Name}} @data.parentIndex={{@index}} }
// Child template
-----------------------------------------------------------------------------
{{parentIndex}} // displays correctly as 2
// does not render
{{#with (lookup report.sections parentIndex)}}
Rendered: {{name}}
{{/with}}
// renders correctly
{{#with (lookup report.sections 2)}}
Rendered: {{name}}
{{/with}}
【问题讨论】:
标签: javascript html handlebars.js jsreport