as shown below, call the api in the background to delete when you click the confirm button for deletion.
confirmDelete(){
let self=this;
let idarr=self.mulId;
let params={
"profileId":idarr
};
return new Promise((resolve,reject)=>{
api.deleteProFile(params).then(res=>{
if(res.errMsg=="Success"){
console.log("");
}
resolve(res.errMsg);
})
})
},
async deleteProfiles(){
let self=this;
let data=self.mulSection;
let flag=false;
let msg=", ?";
data.forEach(item=>{
self.mulId.push(item.id);
})
this.$confirm(msg, "", {
confirmButtonText: "",
cancelButtonText: "",
type: "warning"
}).then(() => {
let msgRet=await self.confirmDelete();
if(msgRet=="Success"){
self.notify("","success",1000);
}
else{
self.notify("","warning",1000);
}
}).catch(() => {
console.log("cancel");
});
},
but every time you click the OK button, you go to the catch section. Then the content in .then () is not executed either. At present, I want to execute the delete method of calling background api in this .then () method.