父组件中:
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();