Quasar Quploader上载失败,上传失败

时间:2018-12-22 20:51:47

标签: quasar-framework quasar

即使在解决了promise后,QUploader也失败,并且触发了@fail事件(进度条为红色,如果将updateProgress设置为1,则进度条停留在99%)。

 <q-uploader
  :url="url"
  :upload-factory="uploadFile"
  :send-raw="true"
  :headers="{ 'content-type': 'application/x-www-form-urlencoded' }"
  :no-content-type="true"
  @add="uploadFileAdded"
  @start="uploadStarted"
  @finish="uploadFinished"
  @uploaded="uploadedFile"
  @fail="uploadFailed"
  color="orange"
  text-color="black"
  auto-expand
  extensions=".csv"
  inverted-light
  float-label="Upload List"
  :multiple="false"
  :hide-upload-button="false"
  :hide-upload-progress="false"
  :clearable="true"
/>

uploadFile(file, updateProgress) {
  return new Promise((resolve, reject) => {
    resolve("Hi");
  });
},

1 个答案:

答案 0 :(得分:1)

仔细阅读后,终于解决了。

上传工厂需要返回上传的文件。

uploadFile(file, updateProgress) {
  return new Promise((resolve, reject) => {
    resolve(file);
  });
},