Skip to content

Documentation for useModal events is missing #385

@Offlein

Description

@Offlein

The documentation for the UseModal() composable makes it clear that the attrs object can contain custom event listeners, but does not explain a fundamental aspect of VFM's expectations.

The question seems to have come up a few times in the Issues here, and you answer it definitively here that event listeners must be prefixed with on, although it's still a little vague. Especially since in this comment I believe you are typo'ing and saying that the event emitted should be onCloseModal

It might save you some trouble to add to the documentation something like this:

  ...
  attrs: {
    // Bind props to the modal component (VueFinalModal in this case).
    clickToClose: true,
    escToClose: true,
    // Bind events to the modal component (VueFinalModal in this case).
    // Any custom event can be listened for when prefixed with "on", e.g. "onEventName".
    onBeforeOpen() { /* on before open */ },
    onOpened() { /* on opened */ },
    onBeforeClose() { /* on before close */ },
    onClosed() { /* on closed */ },
    onCustom() { /* listens for an emitted event with name "custom" */ }
    onSomethingElse() { /* listens for an emitted event with name "somethingElse" */ }
  },
  ...

I'm actually not even 100% sure that an event "somethingElse" would come in via "onSomethingElse" (versus "onSomethingelse" maybe?), but I hope my overall point is clear.

Love the library. Thanks for all you do!

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions