Created
August 21, 2019 09:17
-
-
Save neilwong2012/fec799e0fb490d8d58d6b03be7a8b2b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async initImg (url) { | |
const img = new Image() | |
// ios 9 base64 设置会报错,去掉 | |
if (!url.startsWith('data:image')) { | |
img.setAttribute('crossOrigin', 'Anonymous') | |
} | |
img.src = url | |
await new Promise(resolve => { | |
img.onload = () => { | |
resolve(img) | |
} | |
}) | |
return img | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment