解决Axios发送POST传参后台接收为null问题
1.前端请求格式
//用这种传参 var params = new URLSearchParams() params.append('name', '123')//发送post请求 axios.post("api接口",params,{ //必须加请求头 headers: { 'Content-Type': 'application/json' } }).then(function(res){ //请求回调函数 console.log(res) })
2.后端接收格式
@PostMapping("/test")
//这里要加RequestBody注解来接收参数
public ResponseResult faceRecognzeLogin(@RequestBody String name) {
//...
}

浙公网安备 33010602011771号