IonPopover component works only in one view

Hey guys,

I’ve created a component that I’m using in multiple views which contains an IonPopover. It works well on the index page, but the popover won’t open in any other view.

I did some testing and found that the issue is the id. When I create 2 popovers with the same trigger they won’t work despite living in different views. Do you know why that is? I would expect them to work since the popovers are never mounted at the same time.

Do I need to create the popover programmatically?

Thanks and cheers

Are you sure they are never mounted at the same time? Ionic handles the lifecycle of a page differently than normal Vue. It keeps pages/components around in the DOM to make them quick to come back to making it feel more like a mobile app.

Why not pass in a prop into your custom component for the id so it can be different wherever you are using it?

That’s interesting, I have to check on this. Sounds like this will be the issue!

Great idea! I’m also thinking I could form an ID that incorporates the view slug

1 Like