http的post请求主要有三种类型:
Content-Type: application/json
let data = {"age":"12","name":"aaa"}; axios.post(`${this.$url}/testRequest`,data) .then(res=>{ console.log('res=>',res); })
Content-Type: multipart/form-data
let data = new FormData();
data.append('age','12'); data.append('name','aaa'); axios.post(`${this.$url}/testRequest`,data) .then(res=>{ console.log('res=>',res); })
Content-Type: application/x-www-form-urlencoded
import qs from 'Qs' let data = {"age":"12","name":"aaa"}; axios.post(`${this.$url}/testRequest`,qs.stringify({ data })) .then(res=>{ console.log('res=>',res); })
标签:axios,testRequest,请求,res,Content,post,data From: https://www.cnblogs.com/izyh/p/17461507.html