wx.request里面把responseType设成arraybuffer,然后成功之后wx.arrayBufferToBase64(res.data)转成base64。 getValidateCode:function(){ var that = this; wx.request({ url: validateCodePath, method:'get', responseType: 'arraybuffer', success:function(res){ const base64 = wx.arrayBufferToBase64(res.data); that.setData({ validateCodePath: "data:image/png;base64," + base64 }); } }) }
wx.request返回的是图片的二进制数据,如何用image控件将其显示出来?同标题
2019-02-15