JS_axios请求post方法传递参数后端无法获取

  • post方法传递参数后端无法获取解决方法

方法一:

var params = new URLSearchParams();
params.append("user","123")

axios.post('/user', {
    
    params})
  .then(function (response) {
    
    
    console.log(response);
  })
  .catch(function (error) {
    
    
    console.log(error);
  });

方法二:

headers:{
    
    			//设置上传请求头
	'Content-Type':'application/x-www-form-urlencoded'
},

猜你喜欢

转载自blog.csdn.net/weixin_44599931/article/details/108598085