微信iOS 7.0.20 版本 canvas 2d 绘图无法drawImage图片
var qt = wx.createSelectorQuery();
qt.select('#bbs').fields({ node: true, size: true }).exec((res) => {
let canvas = res[0].node;
canvas.width = self.page.data.windowWidth;
canvas.height = self.page.data.windowHeight;
let layer = canvas.getContext('2d');
let img1 = canvas.createImage();
img1.src = '/image/2.png';
img1.onload = function (res) {
console.log('onload成功')
layer.drawImage(img1, 300, 10, 300, 300);
//方法不执行
}
img1.onerror = function (res) {
console.log('onload失败')
//实际执行了此方法
}
})
微信iOS 7.0.20 版本 使用canvas 2d 绘制drawImage时无法成功绘制,图片不显示,img1.onload不执行,执行了img1.onerror函数,img对象无法onload成功,微信iOS 7.0.18是正常的。