feat: implement onCloseButton event
This commit is contained in:
parent
ae653a77c9
commit
b5857b706f
2 changed files with 12 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<dialog ref="dialog" class="modal" :class="props.obscure ? 'modal-obscure' : 'modal-regular'">
|
<dialog ref="dialog" class="modal" :class="props.obscure ? 'modal-obscure' : 'modal-regular'">
|
||||||
<span class="modal-exit-button-container" style="position: absolute; right: 2em; top: .2em; width: .5em; height: .5em;">
|
<span class="modal-exit-button-container" style="position: absolute; right: 2em; top: .2em; width: .5em; height: .5em;">
|
||||||
<Button text="✕" variant="stealth" :callback="() => dialog?.remove()" />
|
<Button text="✕" variant="stealth" :callback="onCloseButton" />
|
||||||
</span>
|
</span>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<h1 class="modal-title">{{ title }}</h1>
|
<h1 class="modal-title">{{ title }}</h1>
|
||||||
|
@ -17,8 +17,6 @@ import Button from '~/components/UserInterface/Button.vue';
|
||||||
const props = defineProps<ModalProps>();
|
const props = defineProps<ModalProps>();
|
||||||
const dialog = ref<HTMLDialogElement>();
|
const dialog = ref<HTMLDialogElement>();
|
||||||
|
|
||||||
console.log("props:", props);
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (dialog.value) {
|
if (dialog.value) {
|
||||||
dialog.value.showModal();
|
dialog.value.showModal();
|
||||||
|
@ -31,6 +29,15 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function onCloseButton () {
|
||||||
|
if (dialog.value) {
|
||||||
|
if (props.onCloseButton) {
|
||||||
|
props.onCloseButton()
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.value.remove
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,8 @@ export interface ModalProps {
|
||||||
title?: string,
|
title?: string,
|
||||||
obscure?: boolean,
|
obscure?: boolean,
|
||||||
onClose?: () => void,
|
onClose?: () => void,
|
||||||
onCancel?: () => void
|
onCancel?: () => void,
|
||||||
|
onCloseButton?: () => void,
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ContextMenuItem {
|
export interface ContextMenuItem {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue