项目中再table 中添加Upload,Upload中onChange只能返回file参数,如果相对起添加其他参数方便处理可以用下面方法
onChange={(file) => this.handleUploadFileOnChange(file,record)
<Form.Item key={index} required>
{getFieldDecorator(`table[${record.key}].example`, {
initialValue: typeof(text)=='string' ? undefined : text})
( <Upload {...props} fileList={this.state.fileList}
onChange={(file) => this.handleUploadFileOnChange(file,record) } >
<Button>选择文件</Button>
</Upload>
)}
</Form.Item>

本文介绍如何在表单组件Form.Item中,通过Upload控件的onChange事件传递额外参数,以便更灵活地处理文件上传。示例代码展示了如何结合使用file和记录对象进行操作。
3422

被折叠的 条评论
为什么被折叠?



