elementui的$confirm點(diǎn)擊確定按鈕 一直提示取消

位置:首頁(yè) / 新聞中心 / 知識(shí)教程

知識(shí)教程 Admin 2024-02-22 17:34:50 781
this.$confirm('此操作將永久刪除該文件, 是否繼續(xù)?', '提示', {
          confirmButtonText: '確定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {

//業(yè)務(wù)邏輯代碼
          this.$message({
            type: 'success',
            message: '刪除成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消刪除'
          });          
        });

  有一次代碼一直走catch的,提示已取消,然后在then里面添加console.log(“then”)代碼,發(fā)現(xiàn)其實(shí)是有走then里面代碼的,但是then里面的代碼有錯(cuò)誤,所以才跑的catch ,要將代碼錯(cuò)誤報(bào)錯(cuò)出來(lái),將業(yè)務(wù)邏輯代碼復(fù)制出來(lái)跑一下就可以,或者,catch的err輸出一下就行

總結(jié):代碼看起來(lái)沒(méi)問(wèn)題,然后一直走catch,代表then里面的代碼有問(wèn)題

以上就是“elementui的$confirm點(diǎn)擊確定按鈕 一直提示取消”的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注木子天禾科技其它相關(guān)文章!

以上就是“elementui的$confirm點(diǎn)擊確定按鈕 一直提示取消”的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注木子天禾科技其它相關(guān)文章!

15934152105 掃描微信