$confirm确认弹出框的注册及使用


注册
从场景上说,MessageBox 的作用是美化系统自带的 alert、confirm 和 prompt,因此适合展示较为简单的内容。如果需要弹出较为复杂的内容,请使用 Dialog。

//
//局部注册
import { MessageBox } from 'element-ui';

使用
```html
<el-dialog
      title="添加用户"
      :visible.sync="addDialogVisible"
      width="50%"
      @close="addDialogClosed"
      :before-close="handleClose"
    >
 handleClose() {
      MessageBox.confirm("确定要推出编辑吗?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.addDialogVisible = false
          this.$message.info('关闭成功')
        })
        .catch(() => {
          this.$message.info('关闭失败');
        });
    },


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM