在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");
        });
    },

 

转载于:https://www.cnblogs.com/wangshishuai/p/11460048.html

你可能感兴趣的:(javascript,ui,数据库)