上传多个文件时,我无法从$event.target.files中检索它们
<form>
<input type="file" (change)="onuploadFile($event.target.files)" multiple />
</form>
打印稿:
onuploadFile( files : File[]): void{
console.log(files)
}
错误:
Object is possibly 'null'.
Property 'files' does not exist on type 'EventTarget'.
试试这个
<form>
<input type="file" (change)="onuploadFile($any($event.target).files)" multiple />
</form>
点击这里阅读更多