Skip to content

Commit 9ecd723

Browse files
authored
Merge pull request #368 from messenjer/feature/b-nav-dropdown-item-slots-to-child
feat(BNavItemDropdown): pass slots to the child BDropdown
2 parents 66ecf0a + c8a9af9 commit 9ecd723

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed

src/App.vue

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,22 +1659,40 @@
16591659
>
16601660
</div>
16611661

1662-
<!-- <b-nav pills>
1663-
<b-nav-item active>Active</b-nav-item>
1664-
<b-nav-item>Link</b-nav-item>
1665-
<b-nav-item-dropdown
1666-
id="my-nav-dropdown"
1667-
text="Dropdown"
1668-
toggle-class="nav-link-custom"
1669-
right
1670-
>
1671-
<b-dropdown-item>One</b-dropdown-item>
1672-
<b-dropdown-item>Two</b-dropdown-item>
1673-
<b-dropdown-divider></b-dropdown-divider>
1674-
<b-dropdown-item>Three</b-dropdown-item>
1675-
</b-nav-item-dropdown>
1676-
</b-nav>-->
1677-
1662+
<div class="my-2">
1663+
<h2>Nav</h2>
1664+
<h4 class="my-3">Nav with a dropdown</h4>
1665+
<div>
1666+
<b-nav pills>
1667+
<b-nav-item active>Active</b-nav-item>
1668+
<b-nav-item>Link</b-nav-item>
1669+
<b-nav-item-dropdown
1670+
id="my-nav-dropdown"
1671+
text="Dropdown"
1672+
toggle-class="nav-link-custom"
1673+
right
1674+
>
1675+
<b-dropdown-item>One</b-dropdown-item>
1676+
<b-dropdown-item>Two</b-dropdown-item>
1677+
<b-dropdown-divider></b-dropdown-divider>
1678+
<b-dropdown-item>Three</b-dropdown-item>
1679+
</b-nav-item-dropdown>
1680+
</b-nav>
1681+
</div>
1682+
<h4 class="m-2">Nav with a dropdown and a custom Button Icon</h4>
1683+
<div>
1684+
<b-nav pills>
1685+
<b-nav-item active>Active</b-nav-item>
1686+
<b-nav-item>Link</b-nav-item>
1687+
<b-nav-item-dropdown text="Custom Button Icon" no-caret variant="link">
1688+
<template #button-content>
1689+
<img src="./assets/logo.png" style="height: 1em" />
1690+
</template>
1691+
<b-dropdown-item href="#">Action</b-dropdown-item>
1692+
</b-nav-item-dropdown>
1693+
</b-nav>
1694+
</div>
1695+
</div>
16781696
<!-- Tooltip -->
16791697
<div class="my-2">
16801698
<h2>Tooltip</h2>

src/components/BNavItemDropdown.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<template>
22
<li class="nav-item dropdown">
33
<b-dropdown v-bind="$props">
4-
<slot />
4+
<template v-for="(_, slot) in $slots" #[slot]="scope">
5+
<slot :name="slot" v-bind="scope || {}" />
6+
</template>
57
</b-dropdown>
68
</li>
79
</template>

0 commit comments

Comments
 (0)