0

即使在 promise 被解决并触发 @fail 事件之后,QUploader 也会失败(如果 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");
  });
},
4

1 回答 1

1

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

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

uploadFile(file, updateProgress) {
  return new Promise((resolve, reject) => {
    resolve(file);
  });
},
于 2018-12-23T20:21:44.093 回答