我在 angular 8 上工作,我在保存 excel 文件时遇到问题
上传文件进度时
我收到如下错误:
我尝试什么:
this._dataService.PostUpload(this.selectedoptions.toString(),this.fileToUpload)
.subscribe((event: HttpEvent<any>) => {
switch (event.type) {
case HttpEventType.Sent:
console.log('Request has been made!');
break;
case HttpEventType.ResponseHeader:
console.log('Response header has been received!');
break;
case HttpEventType.UploadProgress:
this.progress = Math.round(event.loaded / event.total * 100);
console.log(`Uploaded! ${this.progress}%`);
break;
case HttpEventType.Response:
console.log('User successfully created!', event.body);
this.message='User successfully created!';
setTimeout(() => {
this.progress = 0;
}, 1500);
}saveAs(event, this.fileToUpload.name + '.xlsx')
})
我得到如下结果错误:
结果
Request has been made!
core.js:4002 ERROR TypeError: Failed to execute 'createObjectURL' on 'URL': Overload resolution failed.
at a (FileSaver.min.js:1)
at SafeSubscriber._next (delivery-system.component.ts:265)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:194)
at SafeSubscriber.next (Subscriber.js:132)
at Subscriber._next (Subscriber.js:76)
at Subscriber.next (Subscriber.js:53)
at MergeMapSubscriber.notifyNext (mergeMap.js:84)
at InnerSubscriber._next (InnerSubscriber.js:15)
at InnerSubscriber.Subscriber.next (Subscriber.js:53)
at TapSubscriber._next (tap.js:51)
那么如何解决上述错误?