ElementUI之MessgageBox使用

javascript 复制代码
<template>
  <el-button type="text" @click="open">点击打开 Message Box</el-button>
</template>

<script>
  export default {
    methods: {
      open() {
        this.$confirm('是否完成维修工单?', '提示', {
          distinguishCancelAndClose: true,
          cancelButtonClass:'el-button--danger',
          confirmButtonText: '确认',
          cancelButtonText: '否-异常填报',
          type: 'info'
        })
          .then(() => {
            this.$message({
              type: 'info',
              message: '保存修改'
            });
          })
          .catch(action => {
            this.$message({
              type: 'info',
              message: action === 'cancel'
                ? '放弃保存并离开页面'
                : '停留在当前页面'
            })
          });
      }
    }
  }
</script>
javascript 复制代码
cancelButtonClass:'el-button--danger',

代表取消按钮用单独的css样式

javascript 复制代码
 distinguishCancelAndClose: true,

代表取消和关闭两个事件可以单独控制

javascript 复制代码
 type: 'info',

代表文字前面的图标样式

效果图如下

相关推荐
用户9850335932811 小时前
OpenLayers 热力图从原理到 Vue 组件一键接入
前端
颜酱11 小时前
01 | 骨架搭建:FastAPI + Vue 跑通第一个 SSE 流式问答
前端·人工智能·后端
hoLzwEge11 小时前
解码 IDE 智能提示:jsconfig.json 辅助开发全攻略
前端·前端框架
leoZ23111 小时前
记忆系统与 Agent 定制完全指南(四):自定义 Agent 开发(一)
前端·chrome
慧一居士11 小时前
Element Plus 按需引入的配置使用说明和完整示例
前端·vue.js
程序员黑豆11 小时前
鸿蒙应用开发实战:从零学会自定义组件
前端·华为·harmonyos
leoZ23112 小时前
记忆系统与 Agent 定制完全指南(三):记忆的检索与使用
前端·chrome
遇乐的果园12 小时前
前端学习笔记-vue状态管理优化
前端·笔记·学习
GIS阵地13 小时前
QgsSingleBandPseudoColorRenderer 完整详解(QGIS 3.40.13 C++)
开发语言·前端·c++·qt·qgis
刘较瘦_13 小时前
AI 开发中的 Git Submodule 父子仓库模式:前后端分仓管理与协作实践
前端·github