element——message-box

`${action}`可以捕获用户选择cancel还是confirm,然后进行相应操作

官方文档:http://element-cn.eleme.io/#/zh-CN/component/message-box

test (file) {
  this.$alert('确认从服务器删除jar包?', '提示', {
    confirmButtonText: '确定',
    callback: action => {
      if (`${action}` === 'confirm') {
        console.log('del jar...')
        this.delJar(file)
        // msg
        this.$message({
          type: 'info',
          message: file.name + ' 已删除!'
        })
  }
  // reload data
  this.getJars()
  }
  })
}
原文地址:https://www.cnblogs.com/dannyyao/p/8195954.html