mintUI MessageBox confirm彈框確認和取消按鈕的使用-回調

注意:需要使用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);
          }
        });

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章