vue数组传值到后端
const arrays= ["zhangsan","lisi"]
请求方式:GET
vue前端:
getDetailList({arrays:arrays}).then((res) =>{
//处理查询回的数据
})
后端:
@GetMapping("/getDetailList")
public List<Object> getDetailList(@RequestParam(value="arrays[]", required=false) String[] arrays){
//具体实现
}
请求方式:POST
const names= ["zhangsan","lisi"]
const ids= ["10000","10001"]
vue前端:
batchSaveMap(qs.stringfy({names:names,ids:ids})).then((res) => {
//判断是否保存成功
})
后端:
@PostMapping("/batchSaveMap")
public int batchSaveMap(String[] names,long[] ids){
//具体实现
}

浙公网安备 33010602011771号