$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('关闭失败');
});
},