http请求工具

1.通用写法

axios({
      methods:'get/post/delete/put/patch',//请求类型
  url:'',//请求地址
  data:{},//请求体参数 body参数, get只有地址参数,没有请求提参数
  params:{},//地址参数 最终参数会拼接到url地址上
}).then(result=>{}).catch()

2.别名写法

axios.get(url)
axios.post(url,data)
axios.put(url,data)
axios.delete(url)
axios.patch(url,data)

 

posted @ 2022-08-07 19:20  ajaXJson  阅读(44)  评论(0编辑  收藏  举报