即使在解决了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");
});
},
答案 0 :(得分:1)
仔细阅读后,终于解决了。
上传工厂需要返回上传的文件。
uploadFile(file, updateProgress) {
return new Promise((resolve, reject) => {
resolve(file);
});
},