var app = new Vue({
el: '#app',
data: {
message: ''
},
methods: {
post: function() {
this.$http.post("${base}/beetl/vue", {name:"Vue",age:11}).then(function(res) {
this.message = res.body;
console.log("post请求,"+JSON.stringify(res.body));
}, function(res) {
console.log(res.status)
});
}
},
mounted: function() { //自动执行
this.post();
}
})
@At("/vue")
@Ok("json:full")
public NutMap getVue(@Param("name")String name,@Param("age")int age) {
NutMap obj = new NutMap();
obj.put("name", name);
obj.put("age", age);
return obj;
}