簡體   English   中英

如何使用Meteor延遲{{#each}}內每個循環的每次迭代?

[英]How to delay each iteration of a each loop inside a {{#each}} with Meteor?

我遍歷數組的每個值以在客戶端網頁上創建Highcharts圖。 問題是它滯后了一點,因為它每次迭代都執行得太快了。

所以我的想法是做這樣的事情:

 {{#each containersToCreateChart}}  
 some html that I need to do for each one  
 then wait X milliseconds
 and do the next iteration
 {{/each}}

不確定meteor 但是,如果我想實現您要使用Javascript進行的操作,我會像這樣。

 for (i = 0; i < 5; i++) { (function(i) { setTimeout(function() { console.log('delayed by 2 seconds, now value of "i" is:' + i); }, 2000); })(i); } 

欲了解更多信息,請點擊這里

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM