gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 08:44:33 25 4
gpt4 key购买 nike

我正在关注 this tutorial学习 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'
})

日历.html:

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

主页.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。

提前致谢。

PS:我已经在这里和谷歌上搜索过,但我没能找到这个问题的任何答案。如果有的话,请告诉我正确的地址。

最佳答案

许多使用 0.8 版之前的 Meteor 的示例将无法运行,因此请务必查看最近更新的示例,例如 Discover Meteor 上的示例。 .

在这种情况下,router has been fixed to support Meteor 0.8并且您的示例将通过将 {{renderPage}} 替换为 {{> renderPage}} 来工作。但是,该示例的其余部分可能无法正常工作,正如其他人所提到的,路由器已被弃用 Iron Router .

关于javascript - 创建 Meteor.Router.add() 后显示 [object Object] 的 Meteor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23114107/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com