vue 確認刪除的提示框


image-20201104161736428

image-20201104161820820

需要在element-ui中按需導入

Vue.prototype.$message = Message
Vue.prototype.$confirm = MessageBox.confirm

然后在刪除方法中加入下面代碼就行

/*提示消息*/
      const confirmResult = await this.$confirm('此操作將永久刪除該職位, 是否繼續?', '提示', {
        confirmButtonText: '確定',
        cancelButtonText: '取消',
        type: 'warning'
      }).catch(err => err)
      /*如果用戶確認打印confirm,如果用戶取消顯示cancel*/
      if (confirmResult !== 'confirm') {
        return this.$message.info('已取消刪除!')
      }
      // console.log('確認了刪除')


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM