下面两段代码有什么区别?顶部按预期工作,但底部没有。
// Initially outputs 0, but eventually outputs the # of players.
Meteor.autorun(function() {
var players = Players.find();
console.info(players.count());
});
// Outputs 0 twice. Why does this not work like the block above?
var players = Players.find();
Meteor.autorun(function() {
console.info(players.count());
});
我正在排行榜示例中的 Meteor.isClient 块中对此进行测试。
谢谢你,安德鲁