GET方法
async代表异步
let reqParams = {
url: '/api/recruit/login',
method: 'get',
params: {
account: this.account,
password: this.password
}
};
let res = await axios(reqParams);
POST 方法
let formData=new FormData();//通过formdata上传
formData.append('file',this.files);
console.log("输出 formData.get:",formData.get("file"));
let reqParams = {
url: '/api/recruit/tijiao',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data',
},
data: formData,
};
let res = await axios(reqParams);
注意区别 两个穿的变量一个是params 一个是data 弄了一天 服气 !!!!