如何解决Filepond Firebase恢复
我正在尝试实现还原功能,但是有问题
revert(uniqueFileId,load,error) {
const desertRef = this.storage.ref().child(uniqueFileId);
desertRef.delete().then(function () {
const index = self.files.indexOf(uniqueFileId);
if (index > -1) {
self.files.splice(index,1);
}
load();
}).catch(function (e) {
switch (e.code) {
case 'storage/canceled':
break;
default:
error(e.message)
}
});
},
完整资料 https://gist.github.com/boskiv/dd299cebcec4ca9ef8b8d792c7b4a420
在这种情况下,还原功能中的uniqueFileId
包含来自存储的完整URL。(https://firebasestorage.googleapis.com/v0/b/koko-date-dev.appspot.com/o/gifts%2FhfvhV6Iou15pBj1mhA8b)
在这种情况下是否可以选择仅获取文件名而无需复杂的解析和字符串拆分
在revert
函数中的
在process
函数中的解决方法
uniqueFileId
是传递给process函数内部的load回调的字符串。因此,如果您确定名称是唯一的,则可以在此处传递文件名,该文件名应显示在还原方法中。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。