我知道这个问题已经解决,但是使用Fetch API下载图片时遇到问题。
我用来获取图像的代码。
function downloadImage() {
fetch('https://upload.wikimedia.org/wikipedia/commons/9/98/Pet_dog_fetching_sticks_in_Wales-3April2010.jpg',
{mode: 'no-cors'})
.then(response => response.blob())
.then(blob => {
console.log(blob);
});
}
Run Code Online (Sandbox Code Playgroud)
在这里,console.log我得到回应Blob {size: 0, type: ""}。
请让我知道我在这里做错了吗?