Closing popouts (one or all) programmatically #591
kalnode
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey just thought I'd share my implementation.
I have a custom component "flyout" which I use for all popups/tooltips in my app. Within "flyout" I have an instance of this library (
v-tooltip
) and at any time I could load up another tooltip library.PROBLEM: In my app I also have modals-with-fullscreen-dimmed-backgrounds which captured all clicks and therefore inhibited my flyouts (v-tooltip instances) from closing (via an outside-click). So I would have annoying flyouts remaining open in the background while the user navigates a modal.
SOLUTION: Using an event bus I broadcast (from anywhere in the app) a "flyout-close" command which the flyout component is listening to, and consequently closes itself. I use $refs to set the
isOpen
variable.On a side note, this library does have a Close Directive but I didn't see a clear way to make use of this programmatically. Does anyone know?
Anywhere in my app:
In my "flyout" component:
Beta Was this translation helpful? Give feedback.
All reactions