Skip to content

Commit

Permalink
chore(docs): dropdown $root events example (#2561)
Browse files Browse the repository at this point in the history
  • Loading branch information
TitanFighter authored and tmorehouse committed Feb 14, 2019
1 parent 3467308 commit 8c3a451
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/components/dropdown/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,21 @@ The `hide()` method accepts a single boolean argument. If the argument is `true`
returned to the dropdown toggle button after the menu has closed. Otherwise the document will gain
focus once the menu is closed.

## Listening to dropdown changes via \$root events

To listen to any dropdown opening, use:

```js
mounted() {
this.$root.$on('bv::dropdown::show', (bvEvent) => {
console.log('Dropdown is about to be shown', bvEvent)
})
}
```

Refer to the [Events](/docs/components/dropdown#component-reference) section of documentation for the
full list of events.

## Accessibility

Providing a unique `id` prop ensures ARIA compliance by automatically adding the appropriate
Expand Down

0 comments on commit 8c3a451

Please sign in to comment.