注册表单具有文件上传选项,在“ filehandlechange”事件文件被保存至状态。但是在提交事件时,单击状态值将被清除。
fileUploadHandler
fileChangeHandler = (e) => {
console.log(e.target.files[0])
console.log(e.target.id)
this.setState({
[e.target.id]: e.target.files[0]
},()=>{
console.log(this.state) --- line 171
})
}
FormPilotModal.js:171 *** sp_Licensecopy:文件{名称:“ as.jpeg”,lastModified:1551163826257,lastModifiedDate:Tue Feb 26 2019 12:20:26 GMT + 0530(India Standard Time),webkitRelativePath:“”,大小:56278,…}
提交处理程序
handleSubmit = (e) => {
e.preventDefault();
console.log(this.state) --- line 183
****
控制台值
FormPilotModal.js:183 sp_LicenseNumber:“ r6456” sp_LicenseNumberError:“” sp_Licensecopy:“” sp_Name:“ asdsd” ****