【发布时间】:2020-02-15 05:16:53
【问题描述】:
如何在图像上传到 Firebase 存储后显示模式。
imgRef1.put(file1).then(function(snapshot) {
console.log('Uploaded a blob or file!');
snapshot.ref.getDownloadURL().then(function(downloadURL) {
console.log("File available at", downloadURL);
imgAns1 = downloadURL;
});
}).catch(error => {
console.log("Error Occured");
});;
我正在使用上述代码上传一个文件,并获取图像 URL。然后我将它分配给模式中的 imageview src。
document.getElementById("imgSelectAns1").src = imgAns1;
但是当模态打开时,图像不会加载,因为上传它需要一些时间。图片上传成功后如何打开modal?
【问题讨论】:
-
document.getElementById("imgSelectAns1").src = imgAns1;你到底在哪里?你能展示你的整个代码吗?包括模态窗口的代码。我们需要查看完整代码才能为您提供帮助。
标签: javascript firebase firebase-storage