我正在使用 reactjs 进行项目,目前我正在使用ant-design
表单来选择视频,当用户单击视频然后将视频显示到下方时,我实现了一些逻辑,但是当用户单击删除按钮并选择另一个时,预览视频不会被删除删除按钮。我将分享我的代码,请查看它并请帮助我
谢谢
代码
<PhotoText>Select a Video to Upload</PhotoText>
<FormItem>
{getFieldDecorator('video', {
rules: [
{
required: true,
message: 'Please upload video!',
},
],
})(
<Dragger onChange={this.onChange} accept="video/*">
<p className="ant-upload-drag-icon">
<Icon type="upload" />
</p>
<p className="ant-upload-text">
Click or drag Video to this area to upload
</p>
</Dragger>,
)}
{ this.state.video ? <video width="350" height="280" style={{width:'450px',marginLeft:'23px'}} src={this.state.video} controls/> : null }
</FormItem>