Emit Vue events when Disclosure is opened/closed #883
ustyantsevxx
started this conversation in
Ideas
Replies: 1 comment
-
I needed this functionality recently and ended up with this quick hack: <template>
<Disclosure v-slot="{ open }">
<DisclosureButton @click="open ? emit('closed') : emit('opened')" class="py-2">
Is team pricing available?
</DisclosureButton>
<DisclosurePanel class="text-gray-500">
Yes! You can purchase a license that you can share with your entire team.
</DisclosurePanel>
</Disclosure>
</template>
<script setup>
import {
Disclosure,
DisclosureButton,
DisclosurePanel
} from "@headlessui/vue";
const emit = defineEmits(["opened", "closed"]);
</script> |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Would be helpful if Disclosure components would emit 'opened' and 'closed' events as sometimes its critical to do something just after panel opened or closed
Beta Was this translation helpful? Give feedback.
All reactions