post请求
https://www.cnblogs.com/zhouxiaohouer/p/7999479.html
由于post传参的特殊性,所以
import qs from 'qs';
Vue.prototype.$qs = qs;
this.$axios.post('http://localhost:8081/postinfo',this.$qs.stringify({
firstName:'Fred',
lastName:'Flintstone'
}))
.then(function(res){
console.log(res.data);
})
.catch(function(err){
console.log(err);
});
get请求
axios.get('/user')
.then(function (response) {
console.log(response)
console.log(JSON.parse(response.data));
})
.catch(function (error) {
console.log(error);
});