gpt4 book ai didi

vue.js - 用于 VueJS vue-router 的 Bootstrap nav pills

转载 作者:搜寻专家 更新时间:2023-10-30 22:11:25 26 4
gpt4 key购买 nike

在 bootstrap 官方文档中,我看到了一个很酷的 nav pills 集。就是这个。

<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
<a class="nav-link active" id="v-pills-home-tab" data-toggle="pill" href="#v-pills-home" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</a>
<a class="nav-link" id="v-pills-profile-tab" data-toggle="pill" href="#v-pills-profile" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</a>
<a class="nav-link" id="v-pills-messages-tab" data-toggle="pill" href="#v-pills-messages" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</a>
<a class="nav-link" id="v-pills-settings-tab" data-toggle="pill" href="#v-pills-settings" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</a>
</div>
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">...</div>
<div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">...</div>
<div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab">...</div>
<div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">...</div>
</div>

这是我目前用于导航的代码。

<ul class="nav flex-column">
<li class="nav-item">
<router-link to="/studentDashboard">Dashboard</router-link>
</li>

<li class="nav-item">
<router-link to="/buyPapers">Buy papers</router-link>
</li>

<li class="nav-item" >
<router-link to="/myPapers">My papers</router-link>
</li>

</ul>

我应该更改什么才能在此代码中使用该药丸?

最佳答案

<router-link> by defult is rendered as an achor tag `<a>`.

Bootstap 4 nav-pills 有一个 <a>标签类 nav-link .如下:

<ul class="nav nav-pills">
<li class="nav-item">
<a class="nav-link active" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
</li>
</ul>

所以只需将该类添加到您的 <router-link>

<li class="nav-item">
<router-link class="nav-link" active-class="active" to="/studentDashboard">Dashboard</router-link>
</li>

添加active向表示当前事件路线的导航栏添加类 active-class支持每个`

关于vue.js - 用于 VueJS vue-router 的 Bootstrap nav pills,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49625277/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com