同步循环发请求用promise

function ajax(image, ind) {
    return new Promise(function(resolve, resject) {
       setTimeout(function() {
          addProductImageFn(image, ind)//执行逻辑的方法
          resolve()
       }, 500)
    })
}
 
for(){
  ajax(image, ind) //for循环中执行
}

猜你喜欢

转载自www.cnblogs.com/cnlg123/p/11096128.html