如何将此 Bootstrap 转换为react Bootstrap

kxeu7u2r  于 2022-12-08  发布在  Bootstrap
关注(0)|答案(2)|浏览(177)

我有一个网站是使用引导创建的。现在我正在迁移我的项目React。所以,我试图使用react-bootstrap。有人能帮我翻译这个导航条形码写在引导到react-bootstrap。我已经尝试改变classclassName,但它没有工作。

<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark ftco-navbar-light" id="ftco-navbar">
            <div class="container">
                <a class="navbar-brand" href="/index"><img src="{% static 'lab/images/logos/newlogo.png' %}" /></a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#ftco-nav"
                    aria-controls="ftco-nav" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="oi oi-menu"></span> Menu
                </button>

                <div class="collapse navbar-collapse" id="ftco-nav">
                    <ul class="navbar-nav ml-auto">
                        <li class="nav-item active"><a href="/index" class="nav-link"
                                onMouseOver="this.style.color='#A41034'" onmouseout="this.style.color='black'"
                                style="text-transform: capitalize;">Home</a></li>
                        <li class="nav-item active"><a href="/research" class="nav-link"
                                onMouseOver="this.style.color='#A41034'" onmouseout="this.style.color='black'"
                                style="text-transform: capitalize;">Research</a></li>
                        <li class="nav-item active"><a href="/publications" class="nav-link"
                                onMouseOver="this.style.color='#A41034'" onmouseout="this.style.color='black'"
                                style="text-transform: capitalize;">Publications</a></li>
                        <li class="nav-item active dropdown">
                            <a class="nav-link dropdown-toggle" href="/team" id="navbarDropdown" role="button"
                                onMouseOver="this.style.color='#A41034'" onmouseout="this.style.color='black'"
                                data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"
                                style="text-transform: capitalize;">
                                People
                            </a>
                            <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                <a class="dropdown-item" href="/pi" onMouseOver="this.style.color='#A41034'"
                                    onmouseout="this.style.color='black'">Principal Investigators</a>
                                <a class="dropdown-item" href="/researchers"
                                    onMouseOver="this.style.color='#A41034'"
                                    onmouseout="this.style.color='black'">Senior Scientists</a>
                                <a class="dropdown-item" href="/phd_students"
                                    onMouseOver="this.style.color='#A41034'" onmouseout="this.style.color='black'">PhD/Masters
                                    Students</a>
                                <a class="dropdown-item" href="/students" onMouseOver="this.style.color='#A41034'"
                                    onmouseout="this.style.color='black'">Research Trainees</a>
                                <a class="dropdown-item" href="/alumni" onMouseOver="this.style.color='#A41034'"
                                    onmouseout="this.style.color='black'">Alumni</a>
                            </div>
                        </li>
                        <li class="nav-item active"><a href="/contact" class="nav-link"
                                onMouseOver="this.style.color='#A41034'" onmouseout="this.style.color='black'"
                                style="text-transform: capitalize;">Projects</a></li>
                        <li class="nav-item active"><a href="/joinus" class="nav-link"
                                onMouseOver="this.style.color='#A41034'" onmouseout="this.style.color='black'"
                                style="text-transform: capitalize;">Join
                                Us</a></li>
                    </ul>
                </div>
            </div>
        </nav>
5jvtdoz2

5jvtdoz21#

编写react扩展类以渲染为React组件,然后在另一个文件中编写react Bootstrap ,将navbar CSS导出为应用程序返回的 prop ,确保导入 Bootstrap

r1zk6ea1

r1zk6ea12#

你能确保你包括引导CDN或正确安装引导吗?也确保你导入引导。根据你的代码,它应该工作。

相关问题