【问题标题】:Filepond firebase revertFilepond Firebase 还原
【发布时间】:2020-09-10 23:38:05
【问题描述】:

我正在尝试实现还原功能,但有一个问题

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

在这种情况下,revert 函数中的uniqueFileId 包含来自存储的完整 URL。(https://firebasestorage.googleapis.com/v0/b/koko-date-dev.appspot.com/o/gifts%2FhfvhV6Iou15pBj1mhA8b)

在这种情况下是否可以选择只获取文件名而无需复杂的解析和字符串拆分

revert 函数中的这个

process 函数中的这个

【问题讨论】:

    标签: filepond


    【解决方案1】:

    uniqueFileId 是传递给进程函数内的加载回调的字符串。因此,如果您确定名称是唯一的,您可以在那里传递文件名,它应该出现在 revert 方法中。

    见:https://pqina.nl/filepond/docs/patterns/api/server/

    【讨论】:

    • 但是,加载方法使用 url 加载预览?对吗?
    • 对不起,我的意思是加载回调。请仔细阅读文档。
    猜你喜欢
    • 2023-03-11
    • 2022-06-14
    • 2021-07-29
    • 2015-06-12
    • 2017-10-04
    • 2011-12-19
    • 1970-01-01
    • 1970-01-01
    • 2019-01-02
    相关资源
    最近更新 更多