post像get一样使用params传参

398 阅读1分钟

post像get一样使用params传参

当用axios发起post请求,但是参数不是放在请求体而是像get一样拼接在url后面的情况下:

.post('url', null, { params: {
  name:name,
  age:age
}})
.then(response => response.status)
.catch(err => console.warn(err));