利用id来操作dom //input中 使用accept来接收图片的类型 <input type="file" id="file" accept="image/*" onChange={ this.handlerChange.bind(this) }/> <img src={ this.state.img } alt="" style={ { width: '500px'}}/> //在定义的函数中取出 handlerChange () { const that =