Post projects on the rear end of the data transmission requirements of formdata,
- Then the first thing now setup request header ,, with many package ajax libraries may request header information provided herein as an example to axios
axios({
url:this.dialog.add.upload_url,
method:'post',
data,
headers:{
'Content-Type':'application/x-www-form-urlencoded'
}
}).then(res=>{
if(res.status){
this.$message.success("修改成功");
this.mapping=[];
this.dialog.add.show=false;
this.getTableData();
}
})
Here the object is a data
let data = {
temp_name:"sjsj",
mapping:[{'sda':'dad'},{'sda':'dad'}]
}
But in the past this type of transmission data is correct, but he is not formatted correctly so that the rear end of the received data might not be processed
A new solution FormData () but do not do as the data sent is in fact not formdata
let data=new FormData();
data.append("mapping",this.fileUploadData.mapping)
data.append("temp_name",this.fileUploadData.temp_name)
data.append("_id",this.fileUploadData._id)
Now let's look at network
That's all we want to help