Axios调用后台接口

时间:2022-07-24
本文章向大家介绍Axios调用后台接口,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
 axios.post('http:phpapi.com', {
   key: key,
   type: 'getdata',
   data: {
      id: 1
    }
 })
.then(function (res) {
     // 成功的回调
     console.log(res)
 })
 .catch(function (error) {
      // 失败的回调
     console.log(error);
 });