画了2张图片,一张二维码,一张图片,都能在画布上显示,但是保存在本地后,只有图片显示了,二维码没有显示
// 二维码
const imageCode = canvas.createImage();
imageCode.src = this.data.imgPathSave[0]; //this.data.imgPathSave[0]这是已经处理好的url地址
imageCode.onload = (res) => {
ctx.drawImage(imageCode, 60.55, 100, 38 * dpr, 38 * dpr);
};
// 图片
const himage = canvas.createImage();
himage.src =
"https://sit-ie-uocs-core-shenzhen-xili1-oss.sit.sf-express.com/v1.2/AUTH_sit-IE-UOCS-CORE/sfosspublic001/applet/banner/1695028323388-DEEQAVToralPH1MW6KM%2BMhTE%2FuV7k%3D.png";
himage.onload = (res) => {
ctx.drawImage(himage, 60.55, 28.9, 30 * dpr, 5 * dpr);
wx.canvasToTempFilePath({
canvas: canvas,
success(res) {
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success(res) {
console.log("ok");
},
});
},
});
};