Meteor在向子模板添加参数时会丢失数据上下文

Meteor在向子模板添加参数时会丢失数据上下文,meteor,handlebars.js,Meteor,Handlebars.js,我有这一页: <template name="participant"> {{#with participant}} <div class="participant"> <h3>{{fullname}}</h3> <dl> <dt>E-mail</dt> <dd>{{

我有这一页:

<template name="participant">
      {{#with participant}}
        <div class="participant">
          <h3>{{fullname}}</h3>
            <dl>
                <dt>E-mail</dt>
                <dd>{{email}}</dd>
                <dt>Phone</dt>
                <dd>{{tel}}</dd>
                <dt>City</dt>
                <dd>{{zip}} {{city}}</dd>
                <dt>Creation time</dt>
                <dd>added {{created_on}}</dd>
            </dl>
            {{>quickfield}}
        </div>
      {{/with}}
</template>

<template name="quickfield">
    <input id="{{email}}" value="{{email}}" class="bound">
</template>
它工作得很好

现在,如果要向quickfield子模板添加参数并执行以下操作:

{{>quickfield name="foo"}}
<template name="quickfield">
    <input id="{{name}}" value="{{email}}" class="bound">
</template>
数据上下文在this=participant之前、this=Window之后丢失。{{email}}不再呈现

为什么会这样,解决办法是什么


谢谢大家!

也许您可以访问父上下文:

<template name="quickfield">
  <input id="{{name}}" value="{{../email}}" class="bound">
</template>

但这可能无法解决问题。是的,这是一个很好的解决方法,但我需要访问父级的整个数据上下文,因为我在事件中使用它……不,因为这样做时我会释放局部变量。