如何使用 vue.js 在 Firebase 中保存图像 URL

问题描述

我想将图像 URL 保存在实时数据库中,但我尝试的解决方案都没有解决问题,我编写的代码将图像保存在 firebase 存储中,但我想将图像 URL 保存在实时数据库,所以有人可以帮忙吗?

代码只是将图像保存在 firebase 存储中

这是我的代码

onUpload()
{
  this.picture=null;
  const storageRef=fire.storage().ref(`${this.imageData.name}`).put(this.imageData);
  storageRef.on(`state_changed`,snapshot=>{
    this.uploadValue = (snapshot.bytesTransferred/snapshot.totalBytes)*100;
    
  },error=>{console.log(error.message)},()=>{this.uploadValue=100;
    storageRef.snapshot.ref.getDownloadURL().then((url)=>{
      this.picture =url;
        console.log('File available at',this.picture);
    });
  }
  );
}

我想在实时数据库中保存图片网址

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)