- wx.canvasToTempFilePath 苹果14真机测试 获取的图片不完整
安卓平台保存的图片 [图片] 苹果14保存的图片 [图片] 下面会少一段 let textCtx; let textCanvas; page({ ownTableQr() { this.drowQrPic(bgcPath, picData, this.data.optNum.toString()) }, drowQrPic(bgcImagePath, qrImageData, tableNum) { // 初始化画布大小 const dpr = wx.getWindowInfo().pixelRatio textCanvas.width = 700 * dpr textCanvas.height = 300 * dpr textCtx.scale(dpr, dpr) // textCtx.clearRect(0, 0, 1400, 600); textCtx.beginPath(); const bg = textCanvas.createImage(); const qr = textCanvas.createImage(); //设置填充颜色 为白色 textCtx.fillStyle = "white"; //画矩形 textCtx.fillRect(0, 0, 700, 300) textCtx.fillStyle = "black"; textCtx.font = "25px sans-serif"; bg.src = bgcImagePath; qr.src = qrImageData; bg.onload = () => { textCtx.drawImage(qr, 42.5, 20, 200, 200) textCtx.drawImage(bg, 0, 0, 700, 300) textCtx.fillText(tableNum + '号台', 107.5, 285, 75); } }, async onQrConfirm() { const res = await wx.canvasToTempFilePath({ x: 0, y: 0, width: 700, height: 300, destWidth: 700, destHeight: 300, canvas: textCanvas, }) console.log(res.tempFilePath) const r = await wx.saveImageToPhotosAlbum({ filePath: res.tempFilePath }) console.log(r) }, onReady() { wx.createSelectorQuery().select('#myCanvas').fields({ node: true, size: true }) .exec((res) => { textCanvas = res[0].node // 重点1 textCtx = textCanvas.getContext('2d') // 重点2 }) }, })
05-19 - 真机调试出错?
[图片]
05-05 - module 'utils/utils.js' is not defined 求助 ?
[图片][图片][图片][图片]报这个错误 我折磨我一天了 [图片] 求大佬帮忙看一下哪里的问题!
04-06