显示BASE64图片在真机上显示不出来,模拟器上就可以
var base64 = res.data.img;//通过写文件接口把BASE64的数据转为图片const fileManager = wx.getFileSystemManager();fileManager.writeFile({ filePath: wx.env.USER_DATA_PATH + '/test.png', data: base64, encoding: 'base64', success: res => { if(this.data.imgurl){ this.setData({ imgurl: '' }) } this.imagePath = wx.env.USER_DATA_PATH + '/test.png?t=' + new Date().getTime() console.log('this.imagePath:' + this.imagePath); this.setData({ imgurl: this.imagePath }) }, fail: err => { console.error(err) }}) |
