vue项目中,修改个人信息后点击保存按钮,控制台报错Uncaught (in promise) error
在修改个人信息这个页面中,修改了个人信息后并点击保存,控制台就会报错Uncaught (in promise) error,同时数据也无法保存成功。只有这一个页面有这个错误,其他页面的其他功能都正常。
用于保存的方法:
submitForm(formName) {
this.$refs[formName].validate((valid) => {
/*console.log(this.$refs[formName]);*/
/* debugger*/
if (valid) {
if (this.highLevelTalents == '是') this.user.highLevelTalents = true;
else this.user.highLevelTalents = false;
request({
url: '/user',
headers: {
isToken: true
},
method: 'post',
timeout: 20000,
data: this.user
}).then(()=> {
ElMessageBox.alert('修改已完成,需重新加载页面', '系统提示', {
confirmButtonText: '确定',
type: 'success'
})
.then(() => {
location.reload();
}).catch(()=> {});
});
} else {
console.log('error submit!!')
return false
}
/*console.log(this.user);*/
})
}
运行结果及详细报错内容:
修改的俩处地方,打印出来的也是修改后的值:
我的解答思路和尝试过的方法:尝试过打印this.user,发现修改的数据是有在里面的,但是不知道为什么无法保存成功。查阅网上,大多是说加catch,但是也还是不行。