【问题标题】:<[object Object]> appear instead of downloadurl [duplicate]<[object Object]> 出现而不是 downloadurl [重复]
【发布时间】:2019-08-07 05:17:07
【问题描述】:

downloadurl 没有出现在控制台中,而是 [object,Object] [screenshot image]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);
  })

【问题讨论】:

  • 喜欢复制和粘贴错误消息而不是放置错误图像

标签: typescript firebase


【解决方案1】:

如果您查看the documentationgetDownloadURL() 返回一个承诺,因此您需要等待该承诺解决,然后再尝试访问它:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-31
    • 2018-05-24
    • 2019-09-19
    • 1970-01-01
    • 2011-01-12
    • 1970-01-01
    相关资源
    最近更新 更多