promise

[ https://blog.csdn.net/Ruffaim/article/details/81145263](promise地址) 
          
    // 获取图1信息
    // tip 貌似本地静态文件路径不能做为画布的src参数,网络图片无影响。
    let promise1 = new Promise(function (resolve, reject) {
      wx.getImageInfo({
        src: 'https://qpp.juancdn.com/qpp/181228/4/f/5c2583d033b08948762f1463_208x208.png',
        success: function (res) {
          resolve(res);
        },
        fail: function (res) {
          reject(res)
        }
      })
    });

    // 获取图2信息
    let promise2 = new Promise(function (resolve, reject) {
      wx.getImageInfo({
        src: 'https://qpp.juancdn.com/qpp/181228/4/f/5c2583d033b08948762f1463_208x208.png',
        success: function (res) {
          resolve(res);
        },
        fail: function (res) {
          reject(res)
        }
      })
    });

    // 执行
    Promise.all(
      [promise1, promise2]
    ).then(res => {

    }).
    catch(err => {
      //error 错误处理
    })
复制代码