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',

代表文字前面的图标样式

效果图如下

相关推荐
xiaofeichaichai2 小时前
Webpack
前端·webpack·node.js
问心无愧05132 小时前
ctf show web入门111
android·前端·笔记
唐某人丶2 小时前
模型越来越强,我们还需要 Agent 工程吗?—— 从价值重估到 Harness 实践
前端·agent·ai编程
智码看视界3 小时前
现代Web开发基础:全栈工程师的起航点
前端·后端·c5全栈
JS菌3 小时前
手写一个 AI Agent 全栈项目:从沙箱执行到子智能体的完整实现
前端·人工智能·后端
excel4 小时前
HLS TS 文件损坏的元凶:Git 提交与拉取
前端
Aphasia3114 小时前
https连接传输流程
前端·面试
徐小夕4 小时前
万字长文!千万级文档 RAG 知识库系统落地实践
前端·算法·github
threelab5 小时前
Three.js 物理模拟着色器 | 三维可视化 / AI 提示词
开发语言·前端·javascript·人工智能·3d·着色器