1.post 请求头改成'Content-Type': 'multipart/form-data'
2.用new FormData() 方式 
//上传
export function uploadFile(data) {
  return request({
    url: '/appstore/uploadFile',
    method: 'post',
    headers: {'Content-Type': 'multipart/form-data'},
    data: data
  })
}

 

var file = e.target.files[0];
let param = new FormData();
param.append('fileType','img')
param.append('file',file)
uploadFile(param).then(response => {
  if (response.code === 200) {
    console.log(response)
    that.Form.appLogoUrl=response.filePath;
  } else {
    console.log("上传错误")
  }
});

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐