visua-vue/src/components/composable/useConfirmModal.ts

45 lines
874 B
TypeScript
Raw Normal View History

import type { ConfirmationOptions } from "primevue/confirmationoptions";
import { useConfirm } from "primevue";
import VButton from "../button/VButton.vue";
export function useConfirmModal() {
const showConfirmModal = ({
acceptProps = VButton,
rejectProps = VButton,
group = '',
header = '',
message = '',
icon = '',
accept = () => {},
reject = () => {},
onHide = () => {},
onShow = () => {},
modal = true,
blockScroll = true,
position = 'center',
appendTo = 'body',
}: ConfirmationOptions) => {
const confirm = useConfirm();
confirm.require({
group,
header,
message,
icon,
rejectProps,
acceptProps,
accept,
reject,
onHide,
onShow,
modal,
blockScroll,
position,
appendTo,
});
};
return { showConfirmModal };
}