【发布时间】:2014-03-15 22:44:48
【问题描述】:
我正在构建一个通知页面,用户可以在其中看到哪些帖子有 cmets,并且我想显示每个帖子的日期,但它不起作用。
代码如下:
<template name="notification">
<li><a href="{{notificationPostPath}}">Someone commented your post, {{postDate}}</a> </li>
</template>
Template.notification.helpers({
notificationPostPath: function() {
return Router.routes.PostPage.path({_id: this.postId});
},
post: function () {
return Post.findOne({_id: this.postId});
},
postDate: function() {
return moment(post.submitted).format('dddd, MMMM Do');
}
});
控制台打印:Deps 重新计算异常:ReferenceError: post is not defined。
提前致谢
【问题讨论】:
标签: javascript meteor handlebars.js