12月20
在使用Vue3、TypeScript和ElementUIPlus构建前端时,遇到上传表单数据为[objectObject]且后端SpringBoot报错的情况。通过排查发现前端代码中的`file`对象需要将`raw`属性值作为上传内容,解决了`MissingServletRequestPartException`。

项目场景:
前端:Vue3 + ts + antdv
后端:springboot


打印的file:
发现file内部还有一个raw属性,我们要上传的是这个raw里面的内容

解决方案:
更改前端代码如下:

const file = uploadFileList.value[i];
    formData2.append('file', toRaw(file.raw));
    formData2.append('parentAdcode', formData.parentAdcode);
    importObjects(formData2).then(res=>{
      this.$message.success('导入成功')
    })
分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]