axios的request方法

axios
  .request({
    method: "GET",
    url: "http://localhost:3000/comments",
  })
  .then((response) => {
    console.log(response);
  });

axios的post方法

axios
  .post("http://localhost:3000/comments", {
    body: "今天天气真不错",
    postId: "张三",
  })
  .then((response) => {
    console.log(response);
  });

更多axios封装的发送请求方法可参考:axios使用说明

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐