Skip to content

Commit 8c3a451

Browse files
TitanFightertmorehouse
authored andcommitted
chore(docs): dropdown $root events example (#2561)
1 parent 3467308 commit 8c3a451

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/components/dropdown/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,21 @@ The `hide()` method accepts a single boolean argument. If the argument is `true`
496496
returned to the dropdown toggle button after the menu has closed. Otherwise the document will gain
497497
focus once the menu is closed.
498498

499+
## Listening to dropdown changes via \$root events
500+
501+
To listen to any dropdown opening, use:
502+
503+
```js
504+
mounted() {
505+
this.$root.$on('bv::dropdown::show', (bvEvent) => {
506+
console.log('Dropdown is about to be shown', bvEvent)
507+
})
508+
}
509+
```
510+
511+
Refer to the [Events](/docs/components/dropdown#component-reference) section of documentation for the
512+
full list of events.
513+
499514
## Accessibility
500515

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

0 commit comments

Comments
 (0)