一、请求写法
之前使用 axios请求数据,写法都是下边这种的;
axios.post('url',
{
key: val
})
.then((res)=>{
console.log(res)
})
.catch((error)=>{
console.log(error)
})
后来查了一下文档,发现是有这种写法的;
// 发送 POST 请求
axios({
method: 'post',
url: '/user/12345',
data: {
firstName: 'Fred',
lastName: 'Flintstone'
}
});
// 发送 GET 请求(默认的方法)
axios('/user/12345');
二、qs
看到 qs.stringify()
这个方法,我第一时间想到的是 JSON.stringify()
;
一、对比
qs.