constructor(props) { super(props) this.state = { isNew: true, files:data, businessLicence:data,//营业执照 roofPhone:data,// 屋顶照片 electricityBill:data,//电费清单 propertyCertificate:data,//产权证明 } } // 组件挂载之前,只执行一次 componentDidMount() { } // 上传图片方法 onChange = (image,files1, type, index) => { console.log(files1, type, index); let state = this.state; console.log(state,image,'12'); state[image] = files1 console.log(this.state) //image是个变量 // files[image] = files1; // let {state} = this.state; // state[image] = files1 this.setState({ ...state },()=>{ console.log(this.state) }); }