new Vue({
el:"#app" ,
data:{
user:{
id:"",
username:"",
password:"",
age:"",
sex:"",
},
userList:[]
},
methods:{
findAll:function () {
//在当前方法中定义一个变量,表明是vue对象
var _this= this;
axios.get('/day01_eesy_vuejsdemo/user/findAll.do')
.then(function (response) {
// handle success
_this.userList=response.data;
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
.finally(function () {
// always executed
});
},
findById:function (userid) {
//在当前方法中定义一个变量,表明是vue对象
var _this= this;
axios.get('/day01_eesy_vuejsdemo/user/findById.do',{params:{id:userid}})
.then(function (response) {
// handle success
_this.user=response.data;
$("#myModal").modal("show");
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
.finally(function () {
// always executed
});
},
update:function (user) { //post请求
//在当前方法中定义一个变量,表明是vue对象
var _this= this;
axios.post('/day01_eesy_vuejsdemo/user/updateUser.do', _this.user)
.then(function (response) {
_this.findAll();
console.log(response);
})
.catch(function (error) {
console.log(error);
});
}
},
created:function(){
this.findAll();
}
});
 

最新文章

  1. Live2d-cocos2dx教程(一)例子搭建及运行
  2. synchronized的实现原理-java并发编程的艺术读书笔记
  3. apache启动时80端口占用的解决方法
  4. escape()、encodeURI()、encodeURIComponent()区别详解
  5. uTenux——软件底层驱动组织结构介绍
  6. 集成 WeChat SDK - 支付篇
  7. EF入门 IQueryable和IEnumberable的区别
  8. FCLK PCLK HCLK
  9. SEAndroid安全机制对Binder IPC的保护分析
  10. java开发经验分享(二)
  11. crontab演出newLISP脚本设置环境变量
  12. Insertion Sort List Leetcode
  13. static 还是readonly 还是static readonly
  14. Extensions in UWP Community Toolkit - Overview
  15. 使用Spring Cloud搭建服务注册中心
  16. Leetcode: Encode and Decode TinyURL
  17. 华硕X75VB安装ubuntu12.10网卡不可用等相关问题总结
  18. opcode cache与JIT的区别
  19. Android开源框架Afinal第一篇——揭开圣女的面纱
  20. 【题解】Luogu P2783 有机化学之神偶尔会做作弊

热门文章

  1. pip 常用命令小结
  2. 执行对象Statement、PreparedStatement和CallableStatement详解
  3. 基于hadoop_yarn的资源隔离配置
  4. js 增删节点
  5. [hdu6997]愿望幽灵
  6. [cf1392I]Kevin and Grid
  7. Ubuntu 18.04 WMware 编译 AOSP android-7.1.2_r33 笔记
  8. BehaviorTree.CPP.行为树XML格式(六)
  9. Codeforces 1290D - Coffee Varieties(分块暴力+完全图的链覆盖)
  10. 【豆科基因组】绿豆Mungbean, Vigna radiata基因组2014NC