get 传参数 数组
this.$('/getUserByName',{
params:{
names:['qwe','asd'] + '',
}
}).then(res=>{
(res)
})
//所形成的url为: /getUserByName?names=qwe,asd 等价于 /getUserByName?names=qwe&names=asd
springBoot 后端用数组接收
@GetMapping("/getUserByName")
@ApiOperation("根据名字查询人")
public List getUserByName(@RequestParam() String[] names){
List<JSONObject> list = new ArrayList<>();
for(int i = 0;i<;i++){
JSONObject json = new JSONObject();
("name",names[i]);
("sex","M");
(json);
}
return list;
}