1 回答
TA贡献2019条经验 获得超9个赞
这样不就好了,外边的样式你自己搞吧
multiple={true}是说你点上传框之后,一次性可以选一张还是多张图,false就只能一张张的上传
class ImagePickerExample extends React.Component {
state = {
files: [],
}
onChange = (files, type, index) => {
console.log(files, type, index);
this.setState({
files,
});
}
render() {
const { files } = this.state;
return (
<div>
<ImagePicker
files={files}
onChange={this.onChange}
onImageClick={(index, fs) => console.log(index, fs)}
selectable={files.length < 1}
accept="image/gif,image/jpeg,image/jpg,image/png"
/>
</div>
);
}
}
ReactDOM.render(<ImagePickerExample />, mountNode);
添加回答
举报