Closed yelgogogo closed 7 years ago
最近在使用antd的组件。 当我试图把中的PicturesWall作为一个组件,并表单控件中引入时,不知道怎么才能把fileList的值回传,请问如何解决呢。
<Modal visible={previewVisible} footer={null} onCancel={this.handleCancel}> <img alt="example" style={{ width: '100%' }} src={previewImage} /> </Modal> </div> );
} }
export default PicturesWall;
When I tried to use it in as
Resolved by below code suggesting by others
<Upload action="//localhost:3300/upload" listType="picture-card" fileList={fileList} onPreview={this.handlePreview} onChange={this.handleChange}
handleChange = ({ fileList }) =>{ this.setState({ fileList }); const {onChange} = this.props; this.props.onChange(fileList.map(fl=>fl.response?(HOST+fl.response.path):''));
}
最近在使用antd的组件。
当我试图把中的PicturesWall作为一个组件,并表单控件中引入时,不知道怎么才能把fileList的值回传,请问如何解决呢。
} }
export default PicturesWall;
When I tried to use it in as
Resolved by below code suggesting by others
<Upload action="//localhost:3300/upload" listType="picture-card" fileList={fileList} onPreview={this.handlePreview} onChange={this.handleChange}
handleChange = ({ fileList }) =>{ this.setState({ fileList }); const {onChange} = this.props; this.props.onChange(fileList.map(fl=>fl.response?(HOST+fl.response.path):''));
}