vue button 防重复点击添加loading

在data里面添加状态

loading: false,

在提交按钮上添加元素:loading="loading"

<el-button :loading="loading" size="mini" style="width:75px;" class="mt20" type="primary" @click="handleSubmit()">提交</el-button>

提交时变换状态:
点击提交按钮,loading显示:this.loading = true
提交成功或者失败,loading消失:this.loading = false

async getLoanApplicationSubmit(){
      var numeral = require('numeral')
      let para = {
        bussNo:this.detailsInfo.bussNo, //业务号
        thirdBussNo:this.detailsInfo.thirdBussNo, //第三方业务号
        idType:this.detailsInfo.cusIdType, //证件类型
        idNo:this.detailsInfo.cusIdNo, //证件号
        operateType:this.bussMsg.operateType, //变更类型
        loanPeriod:this.loanAmountinquiry.loanTerm, //贷款期限
        isDeduction:this.automaticRepayment, //是否同意自动抵扣
        autoMethod: this.value ? this.value: 'ACTIVE', //自动还款方式
        accountName:this.applyInfo.applyName, //收款人姓名
        bankCode:this.bankInfo.bankCode, //贷款银行编码
        bankDeposit:this.bankInfo.bankName, //开户银行
        bankAccNo:this.bankAccNo, //贷款银行账号
        applyName:this.applyInfo.applyName, //申请人姓名
        policyJsonDTOList:this.tableData.map(item=>{
          return {
            policyNo:item.policyNo, //保单号
            cvaliDate:item.cvaliDate, //生效日期
            loanAmount:item.loanAmount, //贷款金额
            loanRate:numeral(item.loanRate).value(), //贷款利率
            productName:item.productName, //产品名称
            sumCouldLoanValueSub:item.sumCouldLoanValueSub, //可贷款金额
            stampDutySub:item.stampDutySub, //代扣印花税
            actualAmountSub:item.actualAmountSub, //实付金额
          }
        }), //贷款保单明细
        sumLoanAmount:numeral(this.totalLoanAmount).format('0.00'), //贷款总额
        stampDuty:numeral(this.totalDeduction).format('0.00'), //代付总印花税
        actualAmount:numeral(this.totalAmountReceived).format('0.00'), //实付总金额
      }
      this.loading = true
      const res = await policyLoan.getLoanApplication(para)
      console.log(res)
      if(res.result === '0'){
        console.log('贷款申请提交',res)
        this.infoIsShow = false //有输入框的业务信息隐藏
        this.updateFromIsShow = true //修改按钮显示
        this.bankCardIsShow = false //银行卡信息隐藏
        this.totalIsShow = false //合计信息隐藏
        this.inputIsShow = true //列表输入框隐藏
        this.loading = false
        this.getDetailsList()
        this.$emit('getProcessControlStatus') //刷新流程
      }else{
        this.$message.error(res.resultMessage)
        this.loading = false
      }
    },
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容