For my SPA, I am utilizing bootstrap-vue
and currently working on a page where nested content needs to be placed within b-tabs
.
If given a URL with an anchor (e.g. www.mydomain.com/page123#tab-3
), the goal is to display the content under Tab 3
.
Query: How can this be achieved using bootstrap-vue? Is there a built-in function that allows for this functionality? Reference: (I have not found it in the documentation: )
This is the code snippet:
<b-tabs>
<b-tab title="Tab 1" active>
Tab 1 content
</b-tab>
<b-tab title="Tab 2">
Tab 2 content
</b-tab>
<b-tab title="Tab 3">
Tab 3 content
</b-tab>
</b-tabs>
And below is the HTML output:
<div class="tabs">
<div class="">
<ul role="tablist" tabindex="0" class="nav nav-tabs">
<li class="nav-item">
<a role="tab" tabindex="-1" href="#" class="nav-link active">Tab 1</a>
</li>
<li class="nav-item">
<a role="tab" tabindex="-1" href="#" class="nav-link">Tab 2</a>
</li>
<li class="nav-item">
<a role="tab" tabindex="-1" href="#" class="nav-link">Tab 3</a>
</li>
</ul>
</div>
<div class="tab-content">
<div class="tab-pane show fade active">
Tab 1 content
</div>
<div class="tab-pane fade" style="display: none;">
Tab 2 content
</div>
<div class="tab-pane fade" style="display: none;">
Tab 3 content
</div>
</div>
</div>