【发布时间】:2020-11-23 13:51:54
【问题描述】:
export async function getImage(key){
let url = '';
try{
const imageRef = storage().ref(key)
url = await imageRef.getDownloadURL();
}catch(e){ console.log(e)}
return url;
}
然后...在通话中
imageUrl='';
getImage(email).then((url) => {
imageUrl = url
console.log('imageUrl1:',imageUrl);
})
console.log('imageUrl2:',imageUrl);
结果:
imageUrl2:
imageUrl1:url:https://firebasestorage.googleapis.com/.....
我希望首先是 imageUrl1 的日志....
【问题讨论】:
标签: javascript reactjs firebase async-await firebase-storage