小程序网络请求arraybuffer 转为base64

 wx.request({
            url: result.tempFilePath,
            method: 'GET',
            responseType: 'arraybuffer',
            success: function (res) {
              let base64 = wx.arrayBufferToBase64(res.data);
              console.log(base64);
              $this.setData({
                testImage: 'data:image/jpg;base64,' + base64
              })
            },
            fail: function (res) {
              console.log(res);
            }
          })

 

转载于:https://www.cnblogs.com/znsongshu/p/9404805.html

你可能感兴趣的:(小程序网络请求arraybuffer 转为base64)