import {ElMessage} from "element-plus";

export const xcMessage = {
    success: (msg, isHtml = false) => {
        message(msg, 'success', isHtml)
    },
    danger: (msg, isHtml = false) => {
        message(msg, 'danger', isHtml)
    },
    info: (msg, isHtml = false) => {
        message(msg, 'info', isHtml)
    },
    warning: (msg, isHtml = false) => {
        message(msg, 'warning', isHtml)
    },
    error: (msg, isHtml = false) => {
        message(msg, 'error', isHtml)
    }
}

function message(msg, type, isHtml) {
    ElMessage({
        type: type,
        duration: 2800,
        dangerouslyUseHTMLString: isHtml,
        message: msg,
        showClose: true,
        grouping: true,
    })
}
