【发布时间】:2019-10-10 16:54:31
【问题描述】:
我需要使用来自节点服务器的获取来设置<img> 标记的src 属性。
function fetchPicture(path) {
fetch(path)
.then(function(response) {
return response.blob();
})
.then(function(myBlob) {
return window.URL.CreateObjectURL(myBlob);
});
}
但是,在处理我的.then(response) 中的承诺时,我得到一个 pathToMyHTMLFile/undefined 的文件未找到异常。
我的路径是 http://localhost:8080/Images/fig3.png 类型,响应的状态是 200。
任何提示将不胜感激!
【问题讨论】:
标签: javascript