例子:
submit() {
//从缓存中拿出数据
let uid = UserCenter.getUser().data.data.uid
this.$refs.rulesForm.validate(val => {
if (val) {
HttpClient.doPost(
service + "/admin/auth/forceUpdatePassword",
{
userId: uid,
username:UserCenter.getUser().data.data.username,
password: this.form.password
},
resp => {
this.islogout = true;
this.$message.success("修改密码成功");
/* this.$router.push({
path: "/login"
});
UserCenter.exit() *///清除session
},
msg => {
}
)
}
});
},
我想在submit这个请求中调用另一个请求.直接在resp里面写请求函数不起作用.
使用 watch函数
watch: {
islogout: function(islogout) {
if (this.islogout == true) {
this.handleCommand(); //调用退出方法
}
}
},
就可以了.