inject livewire scripts manually here is the guide https://livewire.laravel.com/docs/installation#manually-including-livewires-frontend-assets
Dec 31, 2023
4
Level 1
Livewire Full Page Component
Hello,
I am using livewire 3 and trying to achieve a SPA-like behavior for rendering different views, which are all in different livewire blade components with the new wire:navigate feature. But its not working. Below is my setup:
- I am using layout.app as below.
- I am using {{ $slot }} in app.blade.php
- I am using livewire components routes as below.
Code Snippets: layout.app:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
================================================== -->
<meta charset="utf-8">
<title>Educenter - Education HTML Template</title>
<!-- Mobile Specific Metas
================================================== -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Construction Html5 Template">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0">
<!-- theme meta -->
<meta name="theme-name" content="edu" />
<!-- ** Plugins Needed for the Project ** -->
<!-- Bootstrap -->
<link rel="stylesheet" href="{{ asset('plugins/bootstrap/bootstrap.min.css') }}">
<!-- slick slider -->
<link rel="stylesheet" href="{{ asset('plugins/slick/slick.css') }}">
<!-- themefy-icon -->
<link rel="stylesheet" href="{{ asset('plugins/themify-icons/themify-icons.css') }}">
<!-- animation css -->
<link rel="stylesheet" href="{{ asset('plugins/animate/animate.css') }}">
<!-- aos -->
<link rel="stylesheet" href="{{ asset('plugins/aos/aos.css') }}">
<!-- venobox popup -->
<link rel="stylesheet" href="{{ asset('plugins/venobox/venobox.css') }}">
<!-- Main Stylesheet -->
<link href="{{ asset('css/style.css') }}" rel="stylesheet">
<!--Favicon-->
<link rel="shortcut icon" href="{{ asset('images/favicon.png') }}" type="image/x-icon">
<link rel="icon" href="{{ asset('images/favicon.png') }}" type="image/x-icon">
</head>
<body>
<livewire:header />
{{ $slot }}
<livewire:footer />
<!-- jQuery -->
<script src="{{ asset('plugins/jQuery/jquery.min.js') }}"></script>
<!-- Bootstrap JS -->
<script src="{{ asset('plugins/bootstrap/bootstrap.min.js') }}"></script>
<!-- slick slider -->
<script src="{{ asset('plugins/slick/slick.min.js') }}"></script>
<!-- aos -->
<script src="{{ asset('plugins/aos/aos.js') }}"></script>
<!-- venobox popup -->
<script src="{{ asset('plugins/venobox/venobox.min.js') }}"></script>
<!-- filter -->
<script src="{{ asset('plugins/filterizr/jquery.filterizr.min.js') }}"></script>
<!-- google map -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCcABaamniA6OL5YvYSpB3pFMNrXwXnLwU"></script>
<script src="{{ asset('plugins/google-map/gmap.js') }}"></script>
<!-- Main Script -->
<script src="{{ asset('js/script.js') }}"></script>
</body>
</html>
Routes:
// Livewire Component Routes
Route::get('/', Home::class)->name('home');
Route::get('/about', About::class)->name('about');
So my header and footer are fixed, only the slot should update as I navigate to different links.
Also when I use wire:navigate, I get a blank page saying "2023"
<a class="dropdown-item" href="{{ route('about') }}" wire:navigate>About</a> // Not Working
How this approach will work, Thanks for your help
Please or to participate in this conversation.