收藏
回答

Unhandled promise rejection?

const promisic = function (n) {
  return function (t = {}) {
    return new Promise((c, r) => {
      const s = Object.assign(t, {
        success: n => {
          c(n)
        },
        fail: n => {
          console.log("n---", n);
          r(n)
        }
      });
      n(s)
    })
  }
},


async onTapAdd() {
      let {
        value: e,
        count: t,
        sizeType: a,
        maxImageSize: i
      } = this.data;
      const l = t - e.length;
      if (e.length >= t || l <= 0) return;
      const r = await promisic(wx.chooseImage)({
        count: l,
        sizeType: a,
        sourceType: ["album", "camera"]
      }),
        s = [],
        n = [];
        console.log("r---140", r);
      r.tempFiles.forEach(e => {
        const {
          path: t,
          size: a
        } = e;
        a > i && i > 0 ? n.push(t) : s.push(t)
      }), this.setData({
        value: e.concat(s)
      }, () => {
        const e = {
          all: this.data.value,
          current: s,
          oversize: n
        };
        console.log("e---154", e);
        eventUtil.emit(this, "linadd", e), eventUtil.emit(this, "linchange", e), eventUtil.emit(this, "linoversize", e)
      })
    },
回答关注问题邀请回答
收藏
登录 后发表内容