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

代表文字前面的图标样式

效果图如下

相关推荐
合作小小程序员小小店20 小时前
web网页开发,在线%商城,电商,商品购买%系统demo,基于vscode,apache,html,css,jquery,php,mysql数据库
开发语言·前端·数据库·mysql·html·php·电商
顾安r20 小时前
11.8 脚本网页 塔防游戏
服务器·前端·javascript·游戏·html
草莓熊Lotso20 小时前
C++ 方向 Web 自动化测试实战:以博客系统为例,从用例到报告全流程解析
前端·网络·c++·人工智能·后端·python·功能测试
fruge20 小时前
Canvas/SVG 冷门用法:实现动态背景与简易数据可视化
前端·信息可视化
一 乐20 小时前
旅游|内蒙古景点旅游|基于Springboot+Vue的内蒙古景点旅游管理系统设计与实现(源码+数据库+文档)
开发语言·前端·数据库·vue.js·spring boot·后端·旅游
驯狼小羊羔21 小时前
学习随笔-require和import
前端·学习
excel21 小时前
🚀 从 GPT-5 流式输出看现代前端的流式请求机制(Koa 实现版)
前端
凸头21 小时前
Spring Boot接收前端参数的注解总结
前端·spring boot·后端
爱吃甜品的糯米团子21 小时前
JavaScript 正则表达式:选择、分组与引用深度解析
前端·javascript·正则表达式
excel21 小时前
Vue SSR 编译器源码深析:ssrTransformShow 的实现原理与设计哲学
前端