在ElementUI的 MessageBox 弹框 进行api接口请求

  confirmDelete(row) {
      let that = this;
      let data = {
        id: row
      };
      that.$axios
        .post(api.destroymodule, data)
        .then(res => {
          if (res.data.success == true) {
            this.$message({
              message: "删除成功",
              type: "success",
              duration:500
            });
          }
        })
        .catch(error => {
          console.log(error);
           this.$message({
          message: '删除失败',
          type: 'error'
        });
        });
    },
    async remover_handleClick(row) {
      let that = this;

      this.$confirm("此操作将永久删除该模块, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(async () => {
          let msgRet = await this.confirmDelete(row.id);
        })
        .catch(() => {
          console.log("cancel");
        });
    },

 

posted @ 2019-09-04 16:45  风一样的猿  阅读(4630)  评论(0编辑  收藏  举报