setBase64Save(base64File) { const fsm = wx.getFileSystemManager(); let extName = base64File.match(/data\:\S+\/(\S+);/) if (extName) { extName = extName[1] } let fileName = Date.now() + '.' + extName return new Promise((resolve, reject) => { let filePath = wx.env.USER_DATA_PATH + '/' + fileName fsm.writeFile({ filePath, data: base64File.replace(/^data:\S+\/\S+;base64,/, ''), encoding: 'base64', success:(res)=>{ console.log('filePath',filePath); resolve(filePath); }, fail() { reject('写入失败'); }, }); }); }
小程序canvas绘制base64的二维码图片,真机上不显示后端接口返回二维码的base64格式图片,canvas绘制图片:ctx.drawImage(qrcodePath, xx, xx, xx, xx),开发者工具显示正常,但是真机上无法显示canvas绘制的二维码图片。手机是iphone 6sp
2021-06-08