var deferred = new Deferred(); var index = 0; results.forEach(function( item ){ //results是数组 index ++; if( index === results.length - 1 ){ deferred.resolve(index); } }); deferred.then(function(last){ if( last ){ button.hidden = false; }else{ button.hidden = true; } });原文链接:https://www.f2er.com/dojo/291138.html