1、axios POST提交pplication/json数据
import axios from 'axios'
let data = {"code":"1234","name":"yyyy"};
axios.post(`${this.$url}/getlist`,data)
.then(res=>{
console.log('res=>',res);
})
2、axios POST提交multipart/form-data数据
import axios from "axios'
let data = new FormData();
data.append('code','1234');
data.append('name','yyyy');
axios.post(`${this.$url}/getlist`,data)
.then(res=>{
console.log('res=>',res);
})
3、axios POST提交application/x-www-form-urlencoded数据
import axios from "axios'
import qs from 'Qs'
let data = {"code":"1234","name":"yyyy"};
axios.post(`${this.$url}/getlist`,qs.stringify({
data
}))
.then(res=>{
console.log('res=>',res);
})