vue elementui 弹框确定后加上loading提示

vue elementui 弹框确定后加上loading提示

this.$confirm("确认取消关联该园所?", "提示", {
    confirmButtonText: "确定",//必填
    cancelButtonText: "取消",//必填
    type: "warning",//必填
    beforeClose: (action, instance, done) => {
      if (action === "confirm") {//必填
        instance.confirmButtonLoading = true;
        instance.confirmButtonText = "执行中...";
        this.postRequest("/api/admin/agency/associateXXX", { //请求路径 postRequest post请求的方式可以超考原生的写法
          schoolId:'',
          relateSchoolId: id,
        }).then(              
          (data) => {
            if (data.status == "200") {
              //业务代码
              this.$message({
                type: "success",
                message: "取消关联成功!",
              });
              this.search();
              //业务代码-End
              
              //必要部分
              done(); 
              setTimeout(() => {
                instance.confirmButtonLoading = false;
              }, 300);
              //必要部分-End
              
              this.changeDialog = false; //业务代码
            } else {
              //必要部分
              done();
              setTimeout(() => {
                instance.confirmButtonLoading = false;
              }, 300);
              //必要部分-End
    
              this.changeDialog = false; //业务代码
            }
          }
        );
      } else {
        done();
      }
    },
  })
  .then(() => {})
  .catch(() => {});

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
elementui弹框按钮是通过在CSS样式中添相应的代码来实现的。在给定样式中,可以看到一个名为`el-popconfirm__action`的类,其中包含了确定和取消按钮的样式。确定按钮使用`.el-button:nth-child(1)`选择器来设置样式,包括右浮动、右边距、背景颜色、边框圆角等属性。取消按钮使用`.el-button:nth-child(2)`选择器来设置样式,包括左浮动、左边距、背景颜色、边框等属性。这些样式可以根据需要进行修改以满足具体的设计需求。<span class="em">1</span><span class="em">2</span> #### 引用[.reference_title] - *1* [elementUI中的Popconfirm弹出框自定义调整(按钮位置,颜色调整)](https://blog.csdn.net/m0_54853420/article/details/123252356)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [vue+elementui实现点击table中的单元格触发事件--弹框](https://download.csdn.net/download/weixin_38624183/12925033)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值