如何使用Element-UI上传功能上传到Firebase?

时间:2017-05-04 10:01:40

标签: firebase vue.js element firebase-storage vuefire

我正在尝试使用Element-UI的组件将文件上传到Firebase的Google Cloud存储。显然,'action'处理程序不接受Firebase上传的'gs://'前缀标准。当我尝试它时,我收到此错误:

XMLHttpRequest cannot load gs://.../x/y. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

有没有解决方法,还是我必须使用其他上传方法?

1 个答案:

答案 0 :(得分:1)

尝试将空字符串传递给action并将自定义函数放入http-request,如下所示:

       <el-upload
            class="upload-demo"
            drag
            action=""
            :http-request="yourCustomFunction"
            :on-preview="handlePreview"
            :on-remove="handleRemove"
            :file-list="fileList"
            multiple>

http-request覆盖默认的xhr行为:http://element.eleme.io/#/en-US/component/upload