2017-04-13 8 views
0

こんにちは私は流星を使用しています& Blaze。Meteor&Blazeテンプレートのサブパネル

私のルートは次のようになります。

FlowRouter.route('/software', { 
    name: 'software', 
    action(params, queryParams) 
    { 
     BlazeLayout.render('App_body', {main_content: 'software_page'}); 
    } 
}); 

そしてApp_bodyに、私はこのように(テンプレートの名前を保持している)main_contentを使用します。

{{> Template.dynamic template=main_content}} 

しかし、今、私は私がしたいことを実現App_bodyに「main_content」以上を挿入します。それぞれのテンプレートのサブパーツを定義する方法はありますか。これは、私の論理的な接続を表しています。

答えて

1

の例では、動的テンプレートを使用していますblaze-layout readmeファイルの最上部にあります:

HTML:ある2番目のパラメータで複数のテンプレート名で送りながら

<template name="layout1"> 
    {{> Template.dynamic template=top}} 
    {{> Template.dynamic template=main}} 
</template> 

<template name="header"> 
    <h1>This is the header</h1> 
</template> 

<template name="postList"> 
    <h2>This is the postList area.</h2> 
</template> 

<template name="singlePost"> 
    <h2>This is the singlePost area.</h2> 
</template> 

今、あなたは、レイアウトをレンダリングすることができます各キーがテンプレート名を指定するオブジェクト。

JS:

BlazeLayout.render('layout1', { top: "header", main: "postList" }); 
関連する問題