药丸标签面板中的嵌套标签在Bootstrap中不起作用

时间:2017-09-22 02:02:59

标签: html css tabs bootstrap-4 nav-pills

我无法在垂直药片标签面板中找到标签,无法在Bootstrap 4中正常工作。

这是一个最小的代码示例:

<html>
<head>
    <link href="bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <script src="popper.min.js"></script>
    <script src="jquery-3.2.1.min.js"></script>
    <script src="bootstrap.min.js"></script>

    <div class="row">
        <div class="col-2">
            <div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist">
                <a class="nav-link active" data-toggle="pill" href="#v-pills-1" role="tab">Pill 1</a>
                <a class="nav-link" data-toggle="pill" href="#v-pills-2" role="tab">Pill 2</a>
                <a class="nav-link" data-toggle="pill" href="#v-pills-3" role="tab">Pill 3</a>
            </div>
        </div>
        <div class="col-10">
            <div class="tab-content" id="v-pills-tabContent">
                <div class="tab-pane fade active show" id="v-pills-1" role="tabpanel">
                    Pill 1 content

                    <!-- tabs
                    <ul class="nav nav-tabs nav-fill" role="tablist">
                        <li class="nav-item">
                            <a class="nav-link active" data-toggle="tab" href="#tabs-1" role="tab">Tab 1</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" data-toggle="tab" href="#tabs-2" role="tab">Tab 2</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" data-toggle="tab" href="#tabs-3" role="tab">Tab 3</a>
                        </li>
                    </ul>

                    <div class="tab-content">
                        <div class="tab-pane active show" id="tabs-1" role="tabpanel">Tab 1 content</div>
                        <div class="tab-pane" id="tabs-2" role="tabpanel">Tab 2 content</div>
                        <div class="tab-pane" id="tabs-3" role="tabpanel">Tab 3 content</div>
                    </div>
                    -->

                </div>
                <div class="tab-pane fade" id="v-pills-2" role="tabpanel">Pill 2 content</div>
                <div class="tab-pane fade" id="v-pills-3" role="tabpanel">Pill 3 content</div>
            </div>
        </div>
    </div>
</body>
</html>

网页功能正常,即垂直药片按预期工作。取消注释为第一个垂直药丸提供嵌套标签的部分后,药丸无法正常运行。单击Pill 2然后Pill 3将显示两个药丸的内容。

为什么这不起作用,我该如何解决?

1 个答案:

答案 0 :(得分:1)

这是bug in version 4.0.0-beta。它在版本4.0.0-beta.2中修复:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js"></script>