ElMessageBox中的子组件回调关闭函数

父组件中:

const closeMessageBox = () => {
    ElMessageBox.close();
    getList();
};


const open = () => {
    ElMessageBox({
        title: '添加商品',
        message: h(AddTaxExemption, { onClose: closeMessageBox }),
        customClass: 'custom-message-box', 
        showConfirmButton: false,
        draggable: true,
    });
};

子组件AddTaxExemption中:

const props = defineProps({
    onClose: Function
});
props.onClose();

你可能感兴趣的:(Vue,ElementPlus,vue3)