前端是Vue+ElementUI
后端是Java SptringBoot
这是前端代码
<el-row>
<el-button @click="gotoHelloWorld">跳转到HelloWorld页面</el-button>
</el-row>
gotoHelloWorld() {
let postData = this.qs.stringify({
testid: this.testid
});
this.axios({
method: 'post',
url: '/hw',
data: postData
}).then(response => {
this.testid = response.data;
}).catch(error => {
console.log(error);
})
}
这是后端代码
@RequestMapping("/hw")
@ResponseBody
public String Hw() {
System.out.println("Test");
String rv = "";
List<Test> resultList = null;
resultList = LeanCloudHelper.findAVObject();
rv = resultList.get(0).getId();
System.out.println(rv);
return rv;
}
前端的按钮按完后,后端的代码并没有执行
请问是哪里错了?