Meteor JS 进度条

3
我正在开发一款Meteor应用程序,用户将点击一个按钮,然后应用程序内部会进行API调用,并将结果附加到HTML中。在API调用期间,我想向用户显示进度条,如何在Meteor中实现?
-谢谢。
1个回答

4

提供更多关于进度条需求的信息可能会有所帮助。

在大多数情况下,我使用:https://github.com/zhouzhuojie/meteor-nprogress。你可以在这里看到演示。

对于你的情况,使用方法类似于:

'click #[buttonId]':function(){
   NProgress.start(); //this starts the progress bar

   Meteor.call('[method name]', function(err, res){
      if(res){
         //Do whatever you want with the result
         NProgress.end(); //this completes the progress bar
      }
   });
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接