Skip to content

Commit f1c52bf

Browse files
committed
v-close-popover docs
1 parent 42ecdf8 commit f1c52bf

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,44 @@ You can change the default values in the [Global options](#global-options).
283283
- `hide`
284284
- `dispose`
285285
- `auto-hide` - Emitted when the popover is closed if clicked outside.
286+
- `close-directive` - Emitted when the popover is closed with the [Close directive](#close-directive).
286287
- `resize` - Emitted when the content size changes. You must set the `handleResize` prop to `true`.
287288

289+
### Close directive
290+
291+
Use the `v-close-popover` directive on an element inside the popover to close it when the element is clicked (or touched on mobile):
292+
293+
```html
294+
<v-popover>
295+
<button>Click me</button>
296+
297+
<template slot="popover">
298+
<a v-close-popover>Close</a>
299+
</template>
300+
</v-popover>
301+
```
302+
303+
You can also set it to true or false to enable or disable the directive (enabled by default):
304+
305+
```html
306+
<a v-popover="false">Close</a>
307+
<a v-popover="true">Close</a>
308+
```
309+
310+
You can also use a property:
311+
312+
```html
313+
<a v-popover="myBooleanProp">Close</a>
314+
```
315+
316+
```js
317+
data () {
318+
return {
319+
myBooleanProp: true,
320+
}
321+
}
322+
```
323+
288324
## Global options
289325

290326
The default global options are:

0 commit comments

Comments
 (0)