如何从Fire-Base Store下载图像.我正在使用Vue-Firestore



我将图像存储在 firbase firestore 上,并将数据存储在集合上。我想在 Vue 应用程序上检索带有图像的数据,但我无法获得下载图像 URL。如何从商店部分从 vue 火库下载所有图像?与关系。例如用户详细信息位于集合文件夹中,个人资料图片位于商店部分。如何从商店部分下载个人资料图片只需在 Vuejs 中编写代码

我的 Sigle 预览代码在这里:

Vuejs , 消防商店 , Vue-Firestore 实时

         const user= fb.auth().currentUser;
     return{
         Profile:db.collection("User_Profile/").doc(user.uid),

     }
 },
 methods:{
selectFile () {
     this.$refs.uploadInput.click()
   },
   detectFiles (e) {
     let fileList = e.target.files || e.dataTransfer.files
     Array.from(Array(fileList.length).keys()).map(x => {
       this.upload(fileList[x])
     })
   },
   upload (file) {
     this.fileName = file.name
     this.uploadTask = fb.storage().ref('UsedCar/' + file.name).put(file)
   },
   deleteImage(img,id){
       let image=fb.storage().refFromURL(img);
       this.allImages.splice(id,1);
       image.delete().then(res=>{
      Swal.fire('Deleted')
       }).catch(error=>{
       Swal.fire({
               type: 'error',
               title: 'Oops...',
               text: 'Something went wrong!',
               footer: '<a href>image Not Deleted</a>'
               })
       })
   }  
 },   
 watch: {
   uploadTask: function () {
     this.uploadTask.on('state_changed', sp => {
     },
     null,
     () => {
       this.uploadTask.snapshot.ref.getDownloadURL().then(downloadURL => {
         this.allImages.push(downloadURL);
       })
     })
   }
 }
}```

为此,您应该在Firebase实时数据库或Firestore中使用Android中的内置下载管理器进行下载否则有已知的方法可以下载上传到存储中的文件

最新更新