Cannot read properties of undefined (reading ‘then‘)

VUE报错,Cannot read properties of undefined (reading ‘then’)

app.config.globalProperties.$mb = (type:any, message:string, title:string) => {
    ElMessageBox({
        type,
        title,
        message,
        closeOnClickModal: true,
        closeOnPressEscape: true,
        callback: () => {
        }
    });
};

app.config.globalProperties.$mb = (type:any, message:string, title:string) => {
    return ElMessageBox({
        type,
        title,
        message,
        closeOnClickModal: true,
        closeOnPressEscape: true,
        callback: () => {
        }
    });
};

加个return就OK了

你可能感兴趣的:(前端,html,vue.js,前端,javascript)