【问题标题】:Meteor.call 'load' parameterMeteor.call 'load' 参数
【发布时间】:2015-11-06 12:36:32
【问题描述】:

Meteor.call 中是否有“加载”参数以及错误和结果参数?只是为了捕获等待事件,以便在 Meteor.call 处理时显示加载图标?如果没有,我确实有替代解决方案。只是想知道是否有比我的更有效的解决方案?谢谢!

【问题讨论】:

标签: javascript meteor


【解决方案1】:

不。您只需要在方法完成之前和之后设置一些反应状态。这是一个例子:

// We are about to start waiting on the method - use this
// to render something like a spinner.
Session.set('loading', true);

Meteor.call('someMethod', function(err, result) {
  // The method returned - stop the spinner.
  Session.set('loading', false);
  // Do something with the result.
  if (!err)
    return console.log(result);
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-09-30
    • 1970-01-01
    • 1970-01-01
    • 2015-09-15
    • 1970-01-01
    • 2014-09-23
    • 2013-03-12
    相关资源
    最近更新 更多