[英]How to delay each iteration of a each loop inside a {{#each}} with Meteor?
I'm looping over each values of an array to create Highcharts graphs on the client webpage. 我遍历数组的每个值以在客户端网页上创建Highcharts图。 The problem is that it lags a bit because it do the each iteration a little too fast.
问题是它滞后了一点,因为它每次迭代都执行得太快了。
So my idea is to do something like this: 所以我的想法是做这样的事情:
{{#each containersToCreateChart}}
some html that I need to do for each one
then wait X milliseconds
and do the next iteration
{{/each}}
Not sure about meteor
. 不确定
meteor
。 But if I want to achieve what you are trying to do in Javascript
I will do like this. 但是,如果我想实现您要使用
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.