美文网首页让前端飞Web前端之路
axios 的 delete请求传递数据的坑

axios 的 delete请求传递数据的坑

作者: IllIIlIlIII | 来源:发表于2019-09-27 16:45 被阅读0次

使用axios写API的时候,发现delete请求一直有问题,最后发现delete跟post、patch等方法接收的第二个参数不一样。post、patch接收的第二个参数直接为需要传输的数据,而delete接收的第二个参数为config。

 axios.request(config)

axios.get(url[, config])

axios.delete(url[, config])

axios.head(url[, config])

axios.post(url[, data[, config]])

axios.put(url[, data[, config]])

axios.patch(url[, data[, config]])

则delete需要通过config来传递数据

axios.delete(url, {data: MyData})

相关文章

网友评论

    本文标题:axios 的 delete请求传递数据的坑

    本文链接:https://www.haomeiwen.com/subject/hcicyctx.html