各位大佬,前端vue小白,现在已经获取到要key,vue要怎么写帮这个值传给后台并返回查询到的数据。
前端
methods: {
viewInfo(data) {
if (data && data.length > 0 && data[0].leaf) {
this.stationId = data[0].id;
this.stationName = data[0].title;
this.voltage = data[0].voltage;
debugger
this.url = path + '/he/setting/powerpath/getPowerSupplyPath.do?&stationName=' + this.voltage +'kV'+ this.stationName
}
},
后端
@RequestMapping(value = "/getPowerSupplyPath.do")
public JSONObject getPowerSupplyPath(String stationId,String stationName){
JSONObject ja = new JSONObject();
boolean flag = false;
try {
List<FaultPowerSupplyPath> list = powerPathManagerWebService.queryPowerSupplyPath(stationId,stationName);
if (list!=null && list.size()>0){
flag = true;
ja.put("list", list);
}
}catch (Exception e){
e.printStackTrace();
}
ja.put("flag", flag);
return ja;
}