element 中MessageBox的封装

MessageBox 弹框
 
import { MessageBox } from 'element-ui'

/**
 * MessageBox 弹框
 * @param {提示信息} text 
 * @param {icon 样式 success / info / warning / error} type 
 * @param {是否居中} center 
 */
export function shure( text= '确定执行此操作吗?', type = 'warning', center = false) {
    return MessageBox.confirm( text , '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: type,
        center: center
    })
}
shure('此操作将删除配置商品, 是否继续?', 'warning', false).then(() => {
    this.$message.success('删除成功!')
}).catch(() => {});
原文地址:https://www.cnblogs.com/J-Luck/p/14955903.html