/*
 * @Author: Kane
 * @Date: 2023-01-30 17:06:10
 * @LastEditors: Kane
 * @LastEditTime: 2023-01-31 16:24:19
 * @FilePath: \IT工具综合平台\src\utils\global.js
 * @Description: 全局方法
 * 
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 */
import { ElMessageBox } from "element-plus";

const globalFunction = {
    deleteConfirm: () =>
    {
        ElMessageBox.confirm("确认删除当前数据吗，删除后无法恢复！", "提示",
            {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                showClose: false,
                closeOnClickModal: false,
                closeOnPressEscape: false,
                type: "warning",
            }
        ).then(() => { });
    },
    message: (param) =>
    {
        console.log(param);
    },
};

export default {
    //vue的use函数，会调用参数对象的install函数进行安装工作，本质上就是往vue实例对象的config.properties
    //属性添加对象或方法。
    install(app)
    {
        app.config.globalProperties["deleteConfirm"] = globalFunction.deleteConfirm;
        app.config.globalProperties["message"] = globalFunction.message;
    },
};
