我的单片预览代码在这里:
vuejs,firestore商店,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);
})
})
}
}
}```
答案 0 :(得分:0)
为此,您应该在Firebase实时数据库或Firestore中具有存储链接,以便使用Android中的内置下载管理器进行下载 否则,有一种方法可以下载存储空间中上传的文件