我用laravel new projectname
创建了一个新的Laravel项目。所以它的选项很少,我选择的设置是jetstream
,inertia
,api, dark, ssr
。但是,当我在app.blade.php
中通过在左侧添加一个项并编译和运行它来编辑导航栏部分时,我的页面没有显示更改。我还希望登录和注册链接也在左边。我还尝试添加一个旋转木马,这是工作,和导航栏(但它不工作)。我的主机没有显示任何错误或警告。
我做了什么。composer require laravel/ui
php artisan ui bootstrap --auth
npm install && npm run dev
npm install @vitejs/plugin-vue --save-dev
npm install vite-plugin-style-import sass
npm install vite-plugin-sass --save-dev
npm install sass-loader
php artisan optimize:clear
我编辑的-基本上是从右边复制到左边
<div id="app">
<nav class="navbar navbar-expand-md navbar-white bg-white">
<div class="container">
<a class="navbar-brand" href="{{ url('/') }}">
{{ config('app.name', 'Laravel') }}
</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">
<!-- Left Side Of Navbar -->
<ul class="navbar-nav me-auto">
{{--Added part--}}
@guest
@if (Route::has('login'))
<li class="nav-item">
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
</li>
@endif
@if (Route::has('register'))
<li class="nav-item">
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
</li>
@endif
@else
<li class="nav-item dropdown">
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
{{ Auth::user()->name }}
</a>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
{{ __('Logout') }}
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
@csrf
</form>
</div>
</li>
@endguest
</ul>
<!-- Right Side Of Navbar -->
<ul class="navbar-nav ms-auto">
<!--Regenerated part -->
@guest
@if (Route::has('login'))
<li class="nav-item">
<a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a>
</li>
@endif
@if (Route::has('register'))
<li class="nav-item">
<a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
</li>
@endif
@else
<li class="nav-item dropdown">
<a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
{{ Auth::user()->name }}
</a>
<div class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ route('logout') }}"
onclick="event.preventDefault();
document.getElementById('logout-form').submit();">
{{ __('Logout') }}
</a>
<form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
@csrf
</form>
</div>
</li>
@endguest
</ul>
</div>
</div>
</nav>
<main class="py-4">
@yield('content')
</main>
</div>
2条答案
按热度按时间x6yk4ghg1#
如果您想更改欢迎页面,您必须更新welcome.blade.php而不是app.blade.php,因为欢迎页面不是从app.blade.php扩展的,我的默认设置
因此,当您在app.blade.php中添加更改时,您可以在从该文件扩展的其他页面中看到更改,例如登录页面:
或者您可以从app.blade.php扩展welcome.blade.php现在您可以在欢迎页面中使用app.blade.php导航栏
ztyzrc3y2#
显然,带有
inertia
的laravel new
也会给予你tailwind
。它与bootstrap有冲突。所以删除这个代码会使它工作