收藏
回答

小程序webview里canvas加载Image安卓真机有兼容问题?

安卓真机有几款机型直接走onerror,IOS真机和开发者工具正常,是兼容问题吗?

示例图片:https://lm-ol-1255625307.cos.ap-beijing.myqcloud.com/yqlm/20210604/b87e199930184eb68edb2ef4020ff0b1.jpg

//JS加载图片类,
const loadImage = (canvas,src) => {
	return new Promise((ok,fail) => {
		let interval = null;
		let seal = new Image();
		// let seal = canvas.createImage();
		seal.setAttribute("crossOrigin",'anonymous');
		seal.onload = (res) => {
			// alert('in loading图片加载完成:' + src);
			ok(seal)
		}
		seal.onerror = err => {
			ok(false)
		}
		seal.src = src;
	})
}
回答关注问题邀请回答
收藏
登录 后发表内容