请问有解决吗
wx.canvasToTempFilePath 生成的图片在ios上部分机型显示空白?mergeImage: function (src) { const query = wx.createSelectorQuery(); query .select('#canvsaMerger') .fields({ node: true, size: true, }) .exec((res) => { const canvas = res[0].node; const ctx = canvas.getContext('2d'); const dpr = 2; // 创建第一张图片 const img1 = canvas.createImage(); img1.src = src; // 创建第二张图片 const img2 = canvas.createImage(); img2.src = './images/qr-code.png'; // 确保两张图片都加载完成 Promise.all([ new Promise((resolve) => { img1.onload = resolve; }), new Promise((resolve) => { img2.onload = resolve; }), ]).then(() => { let img1Width = img1.width; let img1Height = img1.height; // 保持第二张图片的宽高比 let img2Height = img1Width * (img2.height / img2.width); // 动态计算 OFFSET const OFFSET = img1Width * 0.2; // 设置 canvas 临时大小 let canvasWidth = img1Width; let canvasHeight = img1Height + img2Height - OFFSET; const maxSize = 3000 // 检查是否需要缩放以保持在最大尺寸范围内 let scaleFactor = 1; if (canvasWidth * dpr > maxSize || canvasHeight * dpr > maxSize) { scaleFactor = Math.min(maxSize / (canvasWidth * dpr), maxSize / (canvasHeight * dpr)); } // 将比例因子应用于画布和图像尺寸 canvasWidth = canvasWidth * scaleFactor; canvasHeight = canvasHeight * scaleFactor; img1Width = img1Width * scaleFactor; img1Height = img1Height * scaleFactor; img2Height = img2Height * scaleFactor; // 设置实际画布大小,考虑设备像素比 canvas.width = canvasWidth * dpr; canvas.height = canvasHeight * dpr; console.log(canvasWidth, canvasHeight, canvas.width, canvas.height, 'canvas.height') // 上下文已缩放以考虑 DPR ctx.scale(dpr, dpr); // 绘制第一张图像 ctx.drawImage(img1, 0, 0, img1Width, img1Height); // 将第二张图像绘制在第一张图像下方,并带有偏移量 ctx.drawImage(img2, 0, img1Height - OFFSET * scaleFactor, img1Width, img2Height); wx.nextTick(() => { wx.canvasToTempFilePath({ canvas: canvas, x: 0, y: 0, width: canvas.width, height: canvas.height, destWidth: canvasWidth, destHeight: canvasHeight, fileType: 'png', quality: 0.01, success: (res) => { console.log(res.tempFilePath, 'res.tempFilePath1111') // wxfile://tmp_54f0f65f3d69825d65c873a7ac502f9d.png wx.showShareImageMenu({ path: res.tempFilePath, success: function (res) { console.log(res, '2-2-2-') }, fail: function (e) { console.log(e, '20202020') }, complete: function (e) { console.log(e, '20202p2p') }, }); }, fail: (err) => { console.error('导出图片失败', err); }, }, this); }) }); }); },
06-10请问解决了吗
未用云开发功能, 但是一直报错?[图片] https://mmbizwxadpobcos-release-1258344707.cos.ap-shanghai.myqcloud.com/wxabd6448a40289c10/20241010145/ff51c-5daa-e4e6-abf9-57334-webview?append&position=0 这是云开发的地址 ?
05-21修改基础库版本也不行
lazyCodeLoading: "requiredComponents"开启后分包引入组件报错?[图片][图片] 将ec-canvas组件放入分包内,分包内页面引入该组件,当设置了lazyCodeLoading: "requiredComponents",页面白屏报错,去掉lazyCodeLoading: "requiredComponents"就可以正常显示。 基础库版本:3.6.4
2024-11-14请问解决了吗
wx.scanCode扫码后会自动跳转首页,如何禁止跳转?微信扫码之前一直正常,昨天突然出现自动跳转的现象,导致扫码功能现在都无法使用。 [图片] [图片]
2023-06-15[图片]
首次打开小程序点击右上角圆点后台运行后再次开打页面空包报错t is not a function?报错信息如下 <TypeError: t is not a function. (In '40', '4' is an instance of U sa@https://usr//app-service.js:9374:57577 fa@https://usr//app-service.js:9374:57774 U@https://usr//app-service.js:9374:77725 taro3.5.10 基础库版本2.31.0
2023-05-09