基础问题,post请求

这post请求需要的参数是file类型的

img

我这上传的图片数据也是file类型

img

试过很多次,不知道怎么写,没人能问,资源文档也找不到,后面咋写

    async imggo(file){
      console.log(file);
      const res = await imgpost({fileName:file})
      console.log(res);
     }

export const imgpost = file => request.post('/api/vm-service/sku/fileUpload',)

上传文件要以流的形式提交


async imggo(file){
      console.log(file);
      let dataParams = new FormData()
      dataParams.append('fileName',  file)
      const res = await imgpost(dataParams)
      console.log(res);
}
 
export const imgpost = data=> request.post('/api/vm-service/sku/fileUpload',data)

可以看下这篇文章https://blog.51cto.com/u_15688254/5426019

直接上传说接口报错吗