ptitlutins/app/components/atoms/Dialog.vue
2025-09-15 23:03:42 +02:00

33 lines
456 B
Vue

<template>
<dialog ref="dialog">
<slot></slot>
</dialog>
</template>
<script setup>
const props = defineProps({
open: {
type: Boolean,
required: true,
},
});
const dialog = useTemplateRef('dialog')
watch(
() => props.open,
(newVal) => {
if (newVal) {
dialog.value.showModal();
} else {
dialog.value.close();
}
},
);
onMounted(() => {
if (props.open) {
dialog.value.showModal();
}
});
</script>