✨ feature: useConfirmModal composable added
This commit is contained in:
parent
77f4e5460a
commit
88fd6ec0d2
42
src/components/composable/useConfirmModal.ts
Normal file
42
src/components/composable/useConfirmModal.ts
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import { type ConfirmationOptions } from "primevue/confirmationoptions";
|
||||||
|
import { useConfirm } from "primevue";
|
||||||
|
import VButton from "../button/VButton.vue";
|
||||||
|
|
||||||
|
export function useConfirmModal() {
|
||||||
|
const confirm = useConfirm();
|
||||||
|
|
||||||
|
const showConfirmModal = ({
|
||||||
|
acceptProps = VButton,
|
||||||
|
rejectProps = VButton,
|
||||||
|
group = '',
|
||||||
|
header = '',
|
||||||
|
message = '',
|
||||||
|
icon = '',
|
||||||
|
accept = Function,
|
||||||
|
reject = Function,
|
||||||
|
onHide = Function,
|
||||||
|
onShow = Function,
|
||||||
|
modal = true,
|
||||||
|
blockScroll = true,
|
||||||
|
position = 'center',
|
||||||
|
appendTo = 'body',
|
||||||
|
}: ConfirmationOptions) => {
|
||||||
|
confirm.require({
|
||||||
|
group,
|
||||||
|
header,
|
||||||
|
message,
|
||||||
|
icon,
|
||||||
|
rejectProps,
|
||||||
|
acceptProps,
|
||||||
|
accept,
|
||||||
|
reject,
|
||||||
|
onHide,
|
||||||
|
onShow,
|
||||||
|
modal,
|
||||||
|
blockScroll,
|
||||||
|
position,
|
||||||
|
appendTo,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return {showConfirmModal}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user