Quasar Q Uploader 使用上传工厂上传失败
Quasar Quploader failed upload with upload-fcatory
QUploader 即使在解决了 promise 并触发了 @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");
});
},
仔细阅读,终于解决了。
上传工厂需要return上传的文件。
uploadFile(file, updateProgress) {
return new Promise((resolve, reject) => {
resolve(file);
});
},
QUploader 即使在解决了 promise 并触发了 @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");
});
},
仔细阅读,终于解决了。
上传工厂需要return上传的文件。
uploadFile(file, updateProgress) {
return new Promise((resolve, reject) => {
resolve(file);
});
},