Meteor 文本闪烁并消失
这个问题将类似于我先前提出的问题。我让它工作,复制的解决方案,但一定有什么我错过了这里。我从代码开始: router.js:Meteor 文本闪烁并消失,meteor,Meteor,这个问题将类似于我先前提出的问题。我让它工作,复制的解决方案,但一定有什么我错过了这里。我从代码开始: router.js: this.route('note',{ path: '/note/:_id', data: function() { return Notes.findOne(this.params._id); }, }); this.route('notes', { waitOn: function() { return Meteor.subscribe('
this.route('note',{
path: '/note/:_id',
data: function() { return Notes.findOne(this.params._id); },
});
this.route('notes', {
waitOn: function() { return Meteor.subscribe('notes')}
});
模板“注释”:
<table id="notes-table">
{{#each notes}}
<tr id="table-row">
<td id="indicator"></td>
<td id="remove-note" class="icon-close notes-table-class"></td>
<td id="notes-title" class="Nbody notes-table-class">{{this.title}}</td>
<td id="notes-body-prev" class="Nbody notes-table-class">{{this.body}}</td>
</tr>
{{/each}}
</table>
模板“note”是简单的{{title}和{{body}
问题是,当我点击便笺表体时,它确实会将我带到它应该在的位置,这是一个便笺,但它的文本只会闪烁一秒钟,然后立即消失,再也不会回来,所以我什么也看不到。。
问题:问题是什么
我在控制台中没有得到任何错误
此解决方案与“备忘录”解决方案的区别在于:
-这里我用的是桌子,而不是斯潘的
-我在的标签中删除了包装可点击正文(我想这可能是原因)您必须在“注释”路径中订阅才能检索它: 客户:
this.route('note',{
path: '/note/:_id',
waitOn: function() { return Meteor.subscribe('note',this.params._id )}
data: function() { return Notes.findOne(this.params._id); },
});
this.route('notes', {
waitOn: function() { return Meteor.subscribe('notes')}
});
服务器:
Meteor.publish('note', function(noteId){
return Notes.find(this.params._id);
})
在您写的评论中,当您:
将waitOn移动到路由器时,它开始工作。配置。Route.configure waitOn适用于所有路由,因为Method.publish('notes')
函数可能返回notes.find()
,然后note
开始正常工作。是否删除了自动发布?如果是这种情况,您在哪里订阅Notes集合?Autopublish,Insecure all removed。我更新了我的帖子,所以你可以看到我在哪里订阅。这让我思考,当我把waitOn移到Router.configure时,它开始工作了。如果你不介意写建设性的答案来帮助别人,这样我也能给它打分,那就太好了。谢谢
Meteor.publish('note', function(noteId){
return Notes.find(this.params._id);
})