Ion-modal vue composition api


Does anyone have a working implementation of ion-modal in a Vue application using the composition api?

To be specific, I’m talking about an implementation inside the <script setup></script> tag, rather than using setup() method.

It’s doing my head in. How do I get access to the dismiss() method (and whatever else) for the ion-modal component?

It should be as simple as importing modalController from ‘@ionic/vue’, then calling dismiss from the controller. See my example at topv3/About.vue at b3b8dce6363f0e76a3ae27a1cf8820026ba6c4cf · dolthead/topv3 · GitHub

So you use the modalController to popup the modal from one view, then import and use the modalController in the modal view and call dismiss().

I guess my question would be why??

And I guess my answer would be, because.

I’m also prompted to add

Welcome to Ionic Forum — thanks for contributing!

  • Be kind to your fellow community members.
  • Does your reply improve the conversation?
  • Constructive criticism is welcome, but criticize ideas, not people.

AND there just doesn’t seem to be any decent tutorials on Youtube.

Yeah, that’s it. Why do I spend hours glazing over the answer right in front of me.

Thanks. Got it now.