我正在使用带有 Iron:router 包的 Meteor。我正在尝试将基本模板渲染到布局模板中,但不断收到错误消息:
Exception from Tracker recompute function: Error: Couldn't find a template named "/" or "". Are you sure you defined it?
对于我的“/”路线,我有以下内容:
// router.js
Router.configure({
layout: 'layout'
});
Router.route('/', function () {
this.render('welcome');
});
我的模板看起来像:
<!--main.html -->
<head>
<title>App</title>
</head>
<body>
</body>
<template name='layout'>
<div id='container'>
{{> yield}}
</div>
</template>
<template name='welcome'>
<p>Welcome</p>
</template>
对于我的包,我最初尝试只安装 iron:router 插件。它似乎添加了铁:核心、铁:动态模板和铁:布局。我已经分别添加了每个库:
> meteor list
iron:core 0.3.4 Iron namespace and utilities.
iron:dynamic-template 0.4.1 Dynamically create and update templates and the...
iron:layout 0.4.1 Dynamic layouts which enable rendering dynamic ...
iron:router 0.9.4 Routing specifically designed for Meteor
meteor-platform 1.1.1 Include a standard set of Meteor packages in yo...