iron:router在主要yield中渲染多个模板

时间:2015-12-07 15:59:58

标签: templates meteor iron-router

下午好,

我正在尝试创建一个页面,我始终打开导航和页脚模板,并且在主要产量中,我加载参考我正在访问的页面的数据。

我的问题是,在routes.js文件中我使用了以下

Router.configure({
    layoutTemplate:'mainLayout',
    //notFoundTemplate:"notFoundTemplate",
    //loadingTemplate:"loadingTemplate",
});

Router.route('/', function () {

    this.render('navigation', {to: 'navigation'});
    this.render('footer', {to: 'footer'});
    this.render('carousel');
    this.render('oper_areas');
    this.render('partners');
});

我的mainLayout模板就像这样

<template name="mainLayout">

  <header>
    {{> yield 'navigation'}}
  </header>

    {{> yield }}


  <footer class="full-width">
    {{> yield 'footer'}}
  </footer>


</template>

所以我发送导航模板到导航产量,页脚到页脚屈服,这工作正常,然后我试图填充{{&gt;使用'carousel','oper_areas'和'partners'的内容,这将收集我创建主页所需的所有信息,但只显示最后一个。

无论如何我可以把3个模板放在同一个{{&gt;屈服}}同时?

提前感谢您的帮助。

0 个答案:

没有答案