nuxt / ui

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.

Home Page:https://ui.nuxt.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[DOCS][UModal] Add emits on documentation

hamonCordova opened this issue · comments

Description

Today i was trying to find a way how i could know that a modal was closed (when opening programmatically). Then i discovered that existence of onClose emit, wich is fired automatically by the Nuxt UI, but the docs doesn't mention it.

Additional context

No response

Indeed, IIRC barely no event is documented currently so it's not just for <UModal>

I don't know if this is something planned for the next version, but as of now the best documentation is the code itself regarding events.

Also, note that when opening programmatically, you can add a listener for the close event when you open the modal

Also, note that when opening programmatically, you can add a listener for the close event when you open the modal

Could you give an example?

Sure, you can check this playground: https://stackblitz.com/edit/nuxt-ui-jcyjjx?file=app.vue

The second argument of modal.open are the props and listeners of the components you are revealing. As this component must have <UModal /> as a root component, it "inherits" the props and listeners of <UModal />

You should have autocomplete for those normally:
image.png