vue-axios-post方式传递对象至后台

1.对象参数类型JSON化: data:JSON.stringify(object),
2.头部信息headers: "Content-Type": "application/json; charset=UTF-8"
vue-axios-post方式传递对象至后台_第1张图片
3.service中请求方式写为POST ,newsObject是对象类型
vue-axios-post方式传递对象至后台_第2张图片
4.后台controller中获得参数方式:@RequestBody String Object
5.String转换为json:JSONObject accident=JSONObject.fromObject(newsObject);
vue-axios-post方式传递对象至后台_第3张图片

(注:JSONObject将外部为{}的String类型转换为JSONObject;JSONArray是将外部为[]的String类型转换为JSONArray)

你可能感兴趣的:(vue-axios-post方式传递对象至后台)