加载中...

Angular2-5 input-file 选择相同文件不触发change解决方法

博客 2025.05.23 14:26 1009

页面

<input  #uploadImg class="d-none" type="file" (change)="imgCropper($event)">

ts

@ViewChild('uploadImg') uploadImg: any
imgCropper() {
	// 一系列操作
	// 最后把input的value置空
	this.uploadImg.nativeElement.value = ''
}