axios传递数组以及对象,后端接收
前端代码:insertRole() {let data = {role:{rname: "业务员",remark: "业务员",},pids: [1, 2, 3, 4]}this.$axios.post(this.$api + "role/insertRole", data,{indices:false,headers:{'Content-T
·
前端代码:
insertRole() {
let data = {
role:{
rname: "业务员",
remark: "业务员",
},
pids: [1, 2, 3, 4]
}
this.$axios.post(this.$api + "role/insertRole", data,{indices:false,headers:{'Content-Type':'application/json'}}).then().catch(err => {
console.log(err);
})
}
后端代码:
@PostMapping("/role/insertRole")
@ApiOperation(value="添加角色",notes="添加角色")
public void insertRole(@RequestBody RoleVo role){
System.out.println(role);
}
实体:
@Getter
@Setter
@ToString
public class RoleVo {
private Role role;
private List<Integer> pids;
}
更多推荐
已为社区贡献1条内容
所有评论(0)