创建Meteor.Router.add()后显示[object object]的Meteor

Meteor showing [object Object] after creating Meteor.Router.add()

本文关键字:object Meteor 显示 Router add 创建      更新时间:2023-09-26

我将按照本教程学习Meteor。在添加了第一个JS代码之后,我在浏览器上获得了[object object]。我已经按照解释做了所有的事情(除了我更改了一些名字,但我没有使用任何保留词),但我看不到其他任何东西。这部分在前4分钟。我的文件是这样的:

演示.js:

CalEvents = new Meteor.Collection('calevents');
Session.setDefault('editing_calevent', null);
Session.setDefault('showEditEvent', false);
Meteor.Router.add({
    '/':'home',
    '/calendar':'calendar'  
})

calendar.html:

<template name="calendar">
    <div id="calendar">
        Hello world! Now at calendar.
    </div>
</template>

home.html:

<template name="home">
    <div class="hero-unit">
        <p>Manage your calendar</p>
        <p><a class="btn btn-primary btn-large">Learn more</a></p>
    </div>  
</template>

演示.html:

<head>
  <title>Calendar app</title>
</head>
<body>
  {{>menu}}
    <div class="container-fluid">
        <div class="row-fluid"> 
            {{renderPage}}
        </div>
    </div>
</body>

我怀疑这与Meteor.Router.add()行有关,因为我在添加之前所做的一点点工作都奏效了。我曾尝试将"/"上显示的页面更改为包含简单文本的其他页面,但没有成功。

编辑添加:我正在通过Nitrous.io工作,在添加路由器包之前我安装了Meteorite。

提前谢谢。

附言:我在这里和谷歌上搜索过,但一直找不到这个问题的答案。如果有,请给我指正确的地址。

许多使用0.8版本之前的Meteor的示例将不起作用,因此请确保查看最近更新的示例,如Discover Meteor上的示例。

在这种情况下,路由器已经修复为支持Meteor 0.8,您的示例将通过用{{> renderPage}}替换{{renderPage}}来工作。然而,这个例子的其余部分可能不起作用,正如其他人所提到的,路由器已经被Iron router否决了。