axios发送post请求后台接受不到问题

来源:互联网 发布:淘宝挖掘冷门暴利行业 编辑:程序博客网 时间:2024/06/04 18:24
var params = new URLSearchParams();params.append('param1', 'value1');params.append('param2', 'value2');axios.post('/foo', params); 

axios发送请求进行配置(header)的方式

      var _this = this  _this.$ajax.post('http://localhost/mobile/index/login',{par1:_this.par1,par2:_this.par2}      ,{headers: {'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8'}})      .then(function (response) {        _this.$router.push({path:'/index'})      }).catch(function (error) {        console.log(error);      });

解决方案
axios使用详解

原创粉丝点击