diff --git a/src/components/ui/VnConfirm.vue b/src/components/ui/VnConfirm.vue index 4fa374b62..ec9d0f48b 100644 --- a/src/components/ui/VnConfirm.vue +++ b/src/components/ui/VnConfirm.vue @@ -30,10 +30,10 @@ const props = defineProps({ }, }); -defineEmits(['confirm', ...useDialogPluginComponent.emits]); -defineExpose({ show: () => dialogRef.value.show(), hide: () => dialogRef.value.hide() }); +const emit = defineEmits(['confirm', 'cancel', ...useDialogPluginComponent.emits]); -const { dialogRef, onDialogOK } = useDialogPluginComponent(); +const { dialogRef, onDialogHide, onDialogOK, onDialogCancel } = + useDialogPluginComponent(); const title = props.title || t('Confirm'); const message = @@ -53,9 +53,14 @@ async function confirm() { } onDialogOK(props.data); } + +function cancel() { + emit('cancel'); + onDialogCancel(); +} - +