Promise.all 的 then 方法不执行可能是因为传入的 promise 数组中存在某个 promise 出现了错误导致整个 Promise.all 被拒绝(rejected),或者传入的 promise 数组为空。

在这种情况下,你可以使用 catch 方法来捕获错误并进行处理:

Promise.all(promiseArr)
  .then(results => {
    // 处理结果
  })
  .catch(error => {
    // 处理错误
  });

如果你不想处理错误,可以将 catch 方法省略:

Promise.all(promiseArr)
  .then(results => {
    // 处理结果
  });
Vue Promise.all then 方法不执行的原因及解决方法

原文地址: https://www.cveoy.top/t/topic/nI0t 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录