出现<[object Object]>而不是downloadurl

时间:2019-03-16 06:54:19

标签: typescript firebase

downloadurl不在控制台中显示,而是[object,Object] [截屏图片] 1

this.dbs.collection("databases").get().toPromise().then((snapshot) => {
  snapshot.docs.forEach(doc=>{ 
    let name=doc.data().path;
    this.down=this.storage.ref(name).getDownloadURL();
    console.log(name);
    console.log(this.down);
  })

1 个答案:

答案 0 :(得分:0)

如果您查看the documentation,则getDownloadURL()将返回一个承诺,因此您需要等待该承诺解决之后才能尝试访问它:

this.storage.ref(name).getDownloadURL().then((link) => {
  this.down = link;
}