删除某条数据
弹出删除提示框
点击取消
浏览器控制台报错
报错原因:
this.$confirm方法内置promise方法,
所以不能把.catch()去掉(因为取消操作时,无法捕获)
解决方法:
在删除方法的后面加上catch,并在catch里面加上空方法体 ()=>{}
/** 删除按钮操作 */
handleDelete(row) {
const eCodes = row.eCode || this.ids;
this.$confirm('是否确认删除这条数据?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return deleteEquipment(eCodes);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
}).catch(()=>{}) //---这里是重点---
},