I have the following extremely simple code:
var img = new Image()
img.onload = () => {
var canvas = document.createElement("canvas")
var ctx = canvas.getContext("2d")
ctx.drawImage(img, 0, 0)
}
img.src = "xxx"
the above code is fine in most cases, but in Wechat of iOS12, a BUG,onload event will be triggered in advance, and the image has not yet been loaded, so canvas cannot draw the image. It"s not always wrong, it"s just one or two times out of 10.
has anyone met?