收藏
回答

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)
      })
    },
回答关注问题邀请回答
收藏

1 个回答

  • Mr.Zhao
    Mr.Zhao
    2021-11-10

    想提问啥?

    2021-11-10
    有用
    回复 2
    • Qiu (吉²)
      Qiu (吉²)
      2021-11-10
      这个地方报错(Unhandled promise rejection?)
      2021-11-10
      回复
    • Mr.Zhao
      Mr.Zhao
      2021-11-10回复Qiu (吉²)
      2021-11-10
      2
      回复
登录 后发表内容