Bootstrap 下拉菜单打不开

Bootstrap dropdown-menu does'nt open

我导入了这些:

<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js" integrity="sha384-q2kxQ16AaE6UbzuKqyBE9/u/KzioAlnx2maXQHiDX9d4/zp8Ok3f+M7DPm+Ib6IU" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.min.js" integrity="sha384-pQQkAEnwaBkjpqZ8RU1fF1AKtTcHJwFl3pblpTlHXybJjHpMYo79HY3hIi4NKxyj" crossorigin="anonymous"></script>

这里是下拉菜单的 html 代码:

<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    <div class="container-fluid">
        <a class="navbar-brand" href="/">Blog_Flask</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                <li class="nav-item">
                    <a class="nav-link active" href="/">Anasayfa</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link active" href="/about">Hakkımızda</a>
                </li>
                
            </ul>
            <ul class="nav navbar-nav justify-content-end">
            
            {% if session['logged_in'] %}
            
            
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">{{ session["name"] }}</a>
                    <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                        <li><a href="/dashboard" class="dropdown-item">Kontrol Paneli</a></li>
                        <li><a href="/logout" class="dropdown-item">Çıkış Yap</a></li>
                    </ul>
                </li>
                <li class="nav-item">
                    <p style="display: inline;" class="nav-link disable"> olarak giriş yaptınız.</p>
                </li>
                

            {% else %}
            
                <li class="nav-item">
                    <a class="nav-link active" style="display:inline;" href="/login">Giriş Yap</a><p style="display:inline; color:white;">/</p><a class="nav-link active" style="display:inline;" href="/register">Kayıt Ol</a>
                </li>
            
            {% endif %}

            </ul>
        </div>
    </div>
</nav>

但是下拉菜单打不开。 我不知道 HTML 或 bootstrap。你能帮帮我吗?

对了,这是bootstrap5,我用jinja模板写的

您的问题是因为您没有导入正确的文件。

bootstrap5 中唯一需要的导入是

https://getbootstrap.com/docs/5.0/dist/js/bootstrap.bundle.min.js

https://getbootstrap.com/docs/5.0/dist/css/bootstrap.min.css.

这是一个有效的回复: https://repl.it/@ch1ck3n/stackvoerflow-answer-thing