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

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使用详解

你可能感兴趣的:(前端)