promoCode's upload file
<FormGroup
label="Image"
className="col-xs-6"
autoHideHelpText>
<div className="row">
<input type="file" accept=".jpg, .jpeg, .png" onChange={this.handleImageChange}/>
</div>
<div>
<img src={this.state.url} style={{width: 100, height: 100}}/>
</div>
</FormGroup>
三列布局方法:
container: {
display: "grid",
gridTemplateColumns: "30% 70%",
}
显示头像:
<div>
<img src={customer.smallAvatarUrl} style={{width: 200, height: 200, borderRadius: 100}}/>
<input type="file" accept=".jpg, .jpeg, .png" onChange={this.handleImageChange}/>
</div>
lou version
handleImageChange(e) {
let url = URL.createObjectURL(e.target.files[0])
this.setState({url: url})
this.props.updatePromoCodeField("image", e.target.files[0])
}
网友评论