- 需求:如图

- 代码
// 文件上传
handleupLoad=()=>{
const {
fileList } = this.state
if (!fileList) {
message.info('请上传文件')
return
}
const formData = new FormData()
const ImportType = this.ImportFileFromRef.current.getFieldsValue('ImportType').ImportType
//ImportType 是表单上传同时携带的其他参数,如果没有可以省略
fileList.forEach((file) => {
formData.append('File', file)
})
param = {
...param,

本文介绍如何使用Ant Design(antd)组件库结合React,实现CSV文件的上传功能,包括Class组件和Hook两种实现方式。通过此功能,用户可以方便地导入CSV数据到前端应用。
最低0.47元/天 解锁文章

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



