【发布时间】:2014-01-07 10:02:21
【问题描述】:
有没有办法在 Meteor 中嵌套部分(HTML 片段)?
为什么我不能说
<template name="foo">hello world!</template>
<template name="bar">{{> foo}}</template>
<template name="baz">{{> bar}}</template>
?
这是在任何 HTML 页面中非常常见的事情,它是 Mustache 和 Handlebars 的常规功能。为什么我尝试这个时 Meteor 会静默失败?
【问题讨论】:
-
创建一个新项目,将代码添加到.html文件的底部,将
{{> baz}}添加到主模板。一切都按预期工作。我怀疑您的代码还有其他问题。 -
你可以...他们在每一个examples 中都这样做。您必须将顶级模板放在正文模板中:
<body>{{> baz}}</body>