Interrupt the popup layer to execute the close method beforeClose
// 打开弹出层方法
addmobile() {
// 弹出输入框
ElMessageBox.prompt('请输入手机号', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^1[3456789]\d{9}$/,
inputErrorMessage: '手机号不正确',
beforeClose: async (action, instance, done) => {
if (action == "confirm") {//点击确认请求接口
let res: any = await customer_super_update_mobileApi({ id: this.id, mobile: instance.inputValue })
// console.log(res);
// 根据接口返回值判断是否有重复,重新填写或者通过
if (res.code === 1) {
// 通过监测关闭
ElMessage.success('添加成功')
this.getEdit(this.id)
done();
} else {
ElMessage.error(res.msg)
}
} else {
//点击取消关闭
done();
}
}
})
},