yield不是渲染模板

时间:2015-09-24 17:39:35

标签: meteor iron-router

我的项目中只有两个文件。

1)runner.html

<template name="layout">
inside
{{> yield }}
</template>

<template name="test">
Home
</template>

2)runner.js

Router.configure({

layoutTemplate:'layout'
});

Router.map(function(){
this.route("test",{
path:'/',
template: 'test'
})
});

现在,当我打开浏览器时,我只能

inside

即使我删除模板,流星也不会抛出无法找到模板的错误。我最近更新了meteor到1.2.0.1。 还有一个错误在控制台,我无法弄清楚,因为有 代码中没有任何内容。

跟踪是

Exception in callback of async function: MiddlewareStack.prototype.concat@http://localhost:10001/packages/iron_middleware-stack.js?ff70621b6c5f6a406edc60600c4b76126dae21d6:303:7
RouteController.prototype._runRoute@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:542:11
Route.prototype.dispatch@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:856:10
Route/route@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:713:5
boundNext@http://localhost:10001/packages/iron_middleware-stack.js?ff70621b6c5f6a406edc60600c4b76126dae21d6:425:16
Meteor.bindEnvironment/<@http://localhost:10001/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:1007:17
dispatch@http://localhost:10001/packages/iron_middleware-stack.js?ff70621b6c5f6a406edc60600c4b76126dae21d6:449:3
RouteController.prototype.dispatch/</<@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:393:7
Tracker.Computation.prototype._compute@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:357:5
Tracker.Computation@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:245:5
Tracker.autorun@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:596:11
RouteController.prototype.dispatch/<@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:391:5
Tracker.nonreactive@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:623:12
RouteController.prototype.dispatch@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:390:3
Router.prototype.dispatch@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:1700:3
onLocationChange@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:1784:20
Tracker.Computation.prototype._compute@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:357:5
Tracker.Computation@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:245:5
Tracker.autorun@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:596:11
Router.prototype.start@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:1777:31
Router/</<@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:980:9
.withValue@http://localhost:10001/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:979:17
withoutInvocation/<@http://localhost:10001/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:436:26
Meteor.bindEnvironment/<@http://localhost:10001/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:1007:17
onGlobalMessage@http://localhost:10001/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:373:11
 meteor.js:888:11

注意:这两个文件都在项目根目录中,我刚刚安装了iron:router

2 个答案:

答案 0 :(得分:2)

我最有可能遇到同样的问题,最近有很多其他人。它是由我猜测的一些版本问题引起的,因为流星正在经历快速变化。修复工作要做:

meteor add ejson

如下所示:How to use yield and Iron-router?

答案 1 :(得分:0)

流星添加ejson为我修复。花了好几个小时试图找出问题。