加载图片的跨域能否设置成可选
kaiyilian opened this issue · 0 comments
kaiyilian commented
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
})
}
- 图片跨域能支持可选吗?
2.图片的大小是否有限制,图片超过200kb,页面展示一直是img error,用不用懒加载都是一样