this.confirm与async await嵌套使用
async modification(row, operate_type) {const { acticvityId } = row;console.log(JSON.stringify(row));const parms = {operate_type,acticvityId,user_id: user.state.userInfo.user.id,};console.lo...
·
async modification(row, operate_type) {
const parms = {
operate_type,
acticvityId,
user_id: user.state.userInfo.user.id,
};
let res;
if (operate_type == 2) {
this.$confirm('此操作将永久删除该条信息, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
res = await merchanupdate(parms);
})
.then(() => {
if (res && res.error.code == 0) {
Message.success(res.error.msg);
} else {
Message.error(res.error.msg);
}
});
} else {
res = await merchanupdate(parms);
if (res && res.error.code == 0) {
Message.success(res.error.msg);
this.dialogVisible = false;
this.lists();
} else {
Message.error(res.error.msg);
}
}
},
作用域:
同一作用域内async才能使用await
更多推荐
已为社区贡献1条内容
所有评论(0)