wffranco / vue-strap

Bootstrap components built with Vue.js
http://wffranco.github.io/vue-strap/
MIT License
338 stars 133 forks source link

A way to close a popover from parent's component #148

Open joelxr opened 7 years ago

joelxr commented 7 years ago

Hello, the popover component opens and closes based on the trigger mode only (click, focus, etc). But, I'm trying to close an opened popover differently, for example, after clicking a button inside the popover's content (slot).

I can't for example:

import { popover } from 'vue-strap'
// ...
this.popover.show = false

Is there a way to close it from a parent?

Thanks in advance!

claytonrcarter commented 6 years ago

I have had luck giving the popover a ref and using that to call the toggle() method on the popover.

In the template:

<popover ref="myPopover" ...

Then, in your component code:

this.$refs.myPopover.toggle()