vue传递参数到后台_前台使用Vue post请求,后台如何接收请求参数

vue代码

axios.post("DebugController/debugInterface",that.fileModal)

.then(function(res) {

that.button_isloading=false;

that.isreadOnly=false;

if (res.data.data!=null)

{

that.headData = JSON.stringify(res.data.data.head);

that.metaData = JSON.stringify(res.data.data.data);

}

else

{

that.$Notice.warning({

title: "查询出现异常,请检查",

desc: ''

});

}

})

.catch(function(err) {

console.log(err)

})

java代码

controller

方法一获得多个参数

@RequestMapping("debugInterface")

@ResponseBody

public ResultObj debugInterface(@RequestBody LinkedHashMap params) {

ResultObj result = ResultObj.succeed();

String serverName=params.get("serviceName");

return result;

}

方法二获得单个参数

方法三获得Bean

vue代码

axios.post('RedoController/updateRedoTask', redoCondition)

.then(function(res) {

that.addModifyModal = false

that.$Notice.success({

title: 'Redo任务修改成功。',

});

that.query()

})

.catch(function(err) {

console.log(err)

})

java代码

public void updateRedoTask(RedoConditionBean redoCondition) {

RedoSvcTypeBean redoSvcType = redoCondition.getRedoSvcType();

Date date=new Date();

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

redoCondition.setModifyDate(sdf.format(date));

redoConditionMapper.update(redoCondition);

redoSvcTypeMapper.update(redoSvcType);

}


版权声明:本文为weixin_39753584原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。