0
我对下面的代码有问题。我正在用相机拍照,然后将图像上传到Firebase存储。不过,我也将其他数据添加到数据库,它也包含照片网址。上面的脚本开始将图像上传到存储器,但代码的另一部分将不起作用,因为只有在上传过程完成后,this.picurl才会具有值。仅当图像上传完成时才上载附加数据(序列号?)
如何添加序列,以便当this.picurl = savepic.downloadURL最终可用时(图像上传成功),其余代码将运行。
adatfeltolt() {
this.mypicref.child(this.uid()).child('pic.jpg')
.putString(this.picdata, 'base64', { contentType: 'image/jpg' })
.then(savepic => {
this.picurl = savepic.downloadURL
})
this.firebasedb.list("/fogasok/").push({
datum:this.fogasDatuma,
//halfaj:this.fogasHalfaj,
suly:this.fogasSuly,
egyeb:this.fogasEgyeb,
keplink:this.picurl
});
}
谢谢大卫:) – Thomas