我正在尝试在动态模板中呈现动态模板。
主要布局:
<template name="template1">
{{>navbar}}
<div class="container">
{{>Template.dynamic template=content}}
</div>
</template>
子模板:
<template name="template2">
<div class="container">
<div class="row">
<h2>Data Input</h2>
</div>
<div class="row">
<ul class="nav nav-pills">
<li class="active"><a href="/input/inc">Inc</a></li>
<li><a href="/input/exp">Exp</a></li>
</ul>
</div>
<div class="row">
{{>Template.dynamic template=dataSection}}
</div>
</div>
子子模板:
<template name="template3">
<h2>Inc</h2>
</template>
下面是我的 FlowRouter 代码。这是错误的,但我认为它可能会让某人知道我正在尝试做什么。流路由器:
FlowRouter.route('/input/income', {
action: function () {
BlazeLayout.render("template1", {
content: "template2"
});
BlazeLayout.render("template2", {
dataSection: "template3"
});
}
});
我正在尝试在模板 1 内渲染模板 2,然后我想在模板 2 内渲染模板 3。我是否必须以某种方式在模板 2 内渲染模板 3,然后才能在模板 1 内渲染该模板?