注冊
從場景上說,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('關閉失敗');
});
},
