美文网首页
2018-03-06

2018-03-06

作者: NOTEBOOK2 | 来源:发表于2018-03-06 17:25 被阅读0次

https://bitbucket.org/bindolabs/dashboard-ng/commits/0d1c2b96c4c46c76ba1e1b95f6ba3cceb19f42d7?at=feature/customers

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])
  }  

相关文章

网友评论

      本文标题:2018-03-06

      本文链接:https://www.haomeiwen.com/subject/xtlrfftx.html