Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加载图片的跨域能否设置成可选 #52

Open
kaiyilian opened this issue Aug 4, 2023 · 0 comments
Open

加载图片的跨域能否设置成可选 #52

kaiyilian opened this issue Aug 4, 2023 · 0 comments

Comments

@kaiyilian
Copy link

export function loadImage(url) {
return new Promise((resolve, reject) => {
const image = new Image()
image.onload = () => {
resolve(image)
}
image.onerror = () => {
reject(new Error('Image load error'))
}
image.crossOrigin = 'Anonymous' // 支持跨域图片
image.src = url
})
}

  1. 图片跨域能支持可选吗?

2.图片的大小是否有限制,图片超过200kb,页面展示一直是img error,用不用懒加载都是一样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant