使用官方的这种方法 后台取不到参数

方法1:
xios.post('/user', {
    firstName: 'Fred',
    lastName: 'Flintstone'
  })
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

方法二
// 发送 POST 请求
axios({
  method: 'post',
  url: '/user/12345',
  data: {
    firstName: 'Fred',
    lastName: 'Flintstone'
  }
});

 提供一种解决办法:

var params = new URLSearchParams();
params.append('userName', this.userName);
 params.append('account',this.account);
 axios.post('/aircraft/deptRoleBLH_findUserBy.do?',params)
                    .then(response => (this.Datas = response.data.json.userMaps))
                    .catch(error => console.log(error))

 
var params = new URLSearchParams();
params.append('userName', this.userName);
params.append('account',this.account);
axios.post('/aircraft/deptRoleBLH_findUserBy.do?',params)
.then(
response => (
    this.Datas = response.data.json.userMaps
))
.catch(error => console.log(error))

 

Logo

前往低代码交流专区

更多推荐