2021-04-10Axios的post方式

2021-04-10  本文已影响0人  swp小小喀嚓鱼

axios()

 axios({
  method: 'post',
  url: "https://autumnfish.cn/api/user/reg",
  data:{
    username:'jack'
  }
})
  .then(function (response) {
    console.log('one1======='+response.data);
    console.log(response)
  });

axios()


  axios({
  method: 'post',
  baseURL:'https://autumnfish.cn',
  url: "/api/user/reg",
  data:{
    username:'jack'
  }
})
  .then(function (response) {
    console.log('one2======='+response.data);
    console.log(response)
  });

axios.post()

 axios.post('https://autumnfish.cn/api/user/reg',{       
    username:'jack'    
  })
  .then(function (response) {
    console.log('one3======='+response.data);
    console.log(response)
  });

axios.post()

  axios.defaults.baseURL = 'https://autumnfish.cn'
  axios.post('/api/user/reg',{ 
    username:'jack'    
  })
  .then(function (response) {
    console.log('one4======='+response.data);
    console.log(response)
  });
上一篇下一篇

猜你喜欢

热点阅读