我的代码在Chrome和Firefox中运行良好,但是在IE 11中出现了该错误。 完整错误:
尝试在对象'function ElementRef(nativeElement){上用描述符'{“ value”:“ DefaultValueAccessor”,“ configurable”:true}'配置'__source'{ this.nativeElement = nativeElement; }”,并报错,放弃:TypeError:“ __ source”的属性未定义:对象不可扩展。
我的代码:
for(let x = 0; x < this.files.length; x++) {
let filename = this.files[x].name.slice((Math.max(0, this.files[x].name.lastIndexOf(".")) || Infinity) + 1);
for(let y = 0; y < acceptedFileExtensions.length; y ++) {
if(filename === acceptedFileExtensions[y]) {
this.supportedSelectedFiles.push(this.files[x]);
formData.append('files', this.files[x]);
}
}
}
然后,我将带有HTTP帖子的表单数据上传到我的服务器。使该功能也可以在IE 11中使用的解决方案是什么?