能够通过ref调起的选择文件吗?
能够通过ref调起<input type="file"/>的选择文件吗?
276642846
#4
解决了
onChange(e) {
let file = e.target.files[0];
}
aa() {
this.inputRef.click();
}
render() {
return (
<div className="choose-image" onClick={this.aa.bind(this)}>
<Icon type="plus" className="icon" />
<input ref={ref => this.inputRef = ref} type="file" accept="image/*" onChange={this.onChange.bind(this)}/>
</div>
)
}