注意:需要使用then和catch進行捕獲
MessageBox.confirm("", {
message: "你確定刪除嗎?",
title: "警告"
}).then(action => {
if (action == "confirm") {
console.log(1);
this.$http.post(this.$apis.cartdelete, { id }).then(res => {
console.log(res, 11);
if (res.data.code == 200) {
this.goods.splice(idx,1);
Indicator.open("刪除成功...");
setTimeout(() => {
Indicator.close();
}, 600);
}
});
}
})
.catch(err => {
if (err == "cancel") {
console.log(2);
}
});