你還在找在小程序成如何將圖片轉(zhuǎn)base64存儲(chǔ)起來(lái)并顯示嘛,在這里呢,來(lái)瞧瞧。
使用方法
js文件
let $this = this;request({   url:'https://www.dounine.com/hello.jpg',   method:'GET',   responseType: 'arraybuffer',   success:function(res){    let base64 = wx.arrayBufferToBase64(res);    $this.data.userImageBase64 = 'data:image/jpg;base64,' + base64;;   }}); wxml文件
<image src='{{userImageBase64}}' style='width:90rpx;height:90rpx;' />PS:小程序本地圖片轉(zhuǎn)base64最簡(jiǎn)單方法
  wx.chooseImage({   success: function(res) {    console.log(wx.getFileSystemManager().readFileSync(res.tempFilePaths[0], "base64"))   },  })以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持武林網(wǎng)。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注