1

我从我的 url 返回一个 JSON 响应,用于上传,但在代码中我无法得到它,你能建议我在哪里以及如何得到它吗?

onUploadOutput(output: UploadOutput): void {

if (output.type === 'allAddedToQueue') {
  const event: UploadInput = {
    type: 'uploadAll',
    url: this.url,
    method: 'POST',
    data: {foo: 'bar'}
  };

  this.uploadInput.emit(event);

........

} else if (output.type === 'done') {
  this.files.forEach(file => {
    console.log('ciao'); //DIDN'T WORK
    console.log(file.response); //DIDN'T WORK
    this.uploadInput.emit(file.response);
  });
}

this.files = this.files.filter(file => file.progress.status !== UploadStatus.Done);

  }
}
4

1 回答 1

0

找到了解决方案,编辑 ngx-uploader 模块并在 ngx-uploader.js 中更改关于第 236 行的代码:


    xhr.onreadystatechange = () => {
    if (xhr.readyState === 4) {
    /** @type {?} */

于 2019-11-14T10:12:36.860 回答