02
08
10
33
请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

个人信息更新不成功

在vue工程里面使用了

1
2
3
4
5
6
7
confirmModify () { // 确认修改
updateUserInfo(this.userInfo).then((response)=> {
alert('修改成功');
}).catch(function (error) {
console.log(error);
});
}

点击后没有更新成功,没有返回错误信息,数据库没有更新。但是我用获取用户信息就可以正常:

1
2
3
4
5
6
7
getUserInfo () { //请求用户信息
getUserDetail().then((response)=> {
this.userInfo = response.data;
}).catch(function (error) {
console.log(error);
});
},
1
2
3
4
5
6
7
8
userInfo: {
username: '',
gender: '',
birthday: '',
email: '',
mobile: '',
image: '',
},

我在http://localhost:8000/docs/#users-update 可以正常更新,请问怎么知道哪里出错了?

正在回答 回答被采纳积分+3

插入代码

1回答

bobby 2018-08-20 10:10:49

分析前端源码主要有两步 1. 打开浏览器的console 然后点击看看有没有异常,如果此处有异常就是前端的代码异常,对应修改一下就行了,第二 如果console没有异常,就看看网络请求,然后点击看看网络请求有没有发出去,如果发出去了看看返回是不是正确的, 通过这两步就可以定位前端和后端是否有问题

0 回复 有任何疑惑可以回复我~
  • 提问者 前端侠 #1
    老师,请问下,vue端的头像上传该如何处理?可以给个简单的例子吗?
    回复 有任何疑惑可以回复我~ 2018-08-20 11:04:52
  • bobby 回复 提问者 前端侠 #2
    https://element.eleme.io/#/zh-CN/component/upload
    回复 有任何疑惑可以回复我~ 2018-08-21 18:26:16
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号