wx.downloadFile({
url: item.download_url,
success: (res) => {
console.log(item.download_url, res);
if (res.statusCode === 200) {
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
successCount++;
completed++;
this.updateDownloadProgress(mediaList.length, completed, successCount, errorCount);
},
fail: (err) => {
errorCount++;
completed++;
console.error('保存文件到相册失败:', err);
this.updateDownloadProgress(mediaList.length, completed, successCount, errorCount);
},
});
} else {
errorCount++;
completed++;
console.error('下载失败:', res);
this.updateDownloadProgress(mediaList.length, completed, successCount, errorCount);
}
},
fail: (err) => {
errorCount++;
console.error('下载失败:', err);
completed++;
this.updateDownloadProgress(mediaList.length, completed, successCount, errorCount);
}
});
});
上面的代码,console输出为:
Content-Type正确返回了,downloadFile合法域名也正确配置了,实在不知道是什么原因,求助大佬

问题莫名奇妙地被解决了:更新到最新版的微信开发工具,不知道这算不算微信开发工具的Bug
用真机测试