蔡cai
蔡cai
  • 发布:2023-11-07 15:27
  • 更新:2023-11-07 15:27
  • 阅读:344

【解决】APP(ios端)没有Promise.allSettled

分类:uni-app
if (!Promise.allSettled) {  
    const rejectHandler = reason => ({ status: 'rejected', reason });  
    const resolveHandler = value => ({ status: 'fulfilled', value });  
    Promise.allSettled = function (promises) {  
    const convertedPromises = promises.map(p => Promise.resolve(p).then(resolveHandler, rejectHandler));  
        return Promise.all(convertedPromises);  
    };  
}

来源:有点久远,百度的

↓↓↓ 各位大佬点点赞

0 关注 分享

要回复文章请先登录注册