1
我使用模板級預訂
Template.blogPost.onCreated(function() {
var postId = FlowRouter.getParam('postId');
self.subscribe('singlePost', postId);
});
然而,我所看到的例子與
Template.blogPost.onCreated(function() {
var self = this;
self.autorun(function() {
var postId = FlowRouter.getParam('postId');
self.subscribe('singlePost', postId);
});
});
的區別是什麼和它的方法是做它的首選方式是什麼?
我想你的意思是'this.subscribe'在第一個例子中。 –