Documentation for useModal events is missing
Offlein opened this issue · 2 comments
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!
@Offlein
As you can see in the video below:
2023-11-29.22.49.26.mov
You'll see all of the props and events you can use in <VueFinalModal> by vscode's auto completion. I am sure that the TS user can have this DX, but not sure about the js users.
@hunterliu1003 Thank you for the reply. I don't believe I had that intellisense in my JetBrains IDE -- but it's also possible I just missed it!
I see the documentation is updated too! Looks great to me! Much appreciated.