axios之post请求参数
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); })