通常如果我想传递模板变量,我可以使用' ../'而不是{{}}(如How to pass a template variable to a template helper function to preserve context?所示)。
但是,我试图传递模板变量作为将通过自定义块助手提供的值的一部分。
作为一个非常简单的例子,想象{{name}}已在下面的模板中定义,我希望将其作为标题传递:
{{#Card title= ../name }}
<div class="map-container">
Neat name!
</div>
{{/Card}}
我的自定义块助手看起来像这样:
<template name="Card">
<h1 class="card-title">{{title}}</h1>
<div class="card-content">
{{>Template.contentBlock}}
</div>
</template>