vue 确认删除的提示框

vue 确认删除的提示框

需要在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('确认了删除')

相关文章: