axios请求数据post方法

axios({
  headers: {
'X-Requested-With': 'XMLHttpRequest',
'Content-Type': 'application/json; charset=UTF-8',
'Access-Control-Allow-Origin': '*'
},//设置跨域请求
    method: "POST",
      url: "https://solelynet.com/public/index.php/api/v1/UserMenu/GetTree",
      data: {
 "menu_id":1,
"thirdapp_id":1
      }
    })
      .then(function(res) {
     
        console.log(res.data);
        for(var i=0;i<res.data.length;i++){
        console.log(res.data[i].name)
        }
      })
      .catch(function(err) {
        console.log(err);
      });

猜你喜欢

转载自blog.csdn.net/weixin_40888956/article/details/79949008