场景:在使用iview时,定义api请求时,代码如下

export const delWord = (data) => {
return axios.request({
url: '/words/del',
params: data,
method: 'post'
})
}
请求数据,后台接口响应了,但是没有响应我的参数,还让后台工程师帮我大了log,发现传过去的id始终是0
原因:在发送请求时,如果如下写其实根本没有参数发过去的。post对应的是data,get对应的是params
    params: data,
method: 'post'
解决:
export const delWord = (data) => {
return axios.request({
url: '/words/del',
data: data,
method: 'post'
})
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2022-01-05
  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2022-12-23
  • 2021-09-18
相关资源
相似解决方案