chore(Slideover): emit event

This commit is contained in:
Benjamin Canac
2023-01-13 18:32:45 +01:00
parent cfc4bdfbfe
commit 2bc0eb05d1

View File

@@ -1,6 +1,6 @@
<template> <template>
<TransitionRoot as="template" :appear="appear" :show="isOpen"> <TransitionRoot as="template" :appear="appear" :show="isOpen">
<Dialog :class="[wrapperClass, { 'justify-end': side === 'right' }]" @close="isOpen = false"> <Dialog :class="[wrapperClass, { 'justify-end': side === 'right' }]" @close="close">
<TransitionChild <TransitionChild
v-if="overlay" v-if="overlay"
as="template" as="template"
@@ -89,7 +89,7 @@ const props = defineProps({
} }
}) })
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue', 'close'])
const isOpen: WritableComputedRef<boolean> = computed({ const isOpen: WritableComputedRef<boolean> = computed({
get () { get () {
@@ -129,6 +129,11 @@ const slideoverTransition = computed(() => {
...props.transitionClass ...props.transitionClass
} }
}) })
function close (value: boolean) {
isOpen.value = value
emit('close')
}
</script> </script>
<script lang="ts"> <script lang="ts">