Closed pixsolution closed 1 year ago
Hi there, I'm sorry to hear that you weren't able to get it up'n'running with the provided docs. I'm not sure about the reason but I will take a look into it later today and maybe I will make an example project. Cheers, Erik
Ok, so reviewed the process of getting this package up'n'running. I found a few things that definitely could and should be made easier, but as the release of Livewire v3 might right around the corner I limited the improvements to the docs. The basic steps are:
I made a sample project to demonstrate these steps: https://github.com/esadewater/livewire-maps-sample
I hope I could help you with this! Cheers, Erik
Hi @esadewater thanks, I tried those steps but nothing yet.
My app.js
import './bootstrap';
import Alpine from 'alpinejs';
import focus from '@alpinejs/focus';
import { init } from "../../vendor/esadewater/livewire-maps/resources/js/LiveWireMaps";
window.Alpine = Alpine;
Alpine.plugin(focus);
Alpine.start();
init();
after modified app.js I runned npm run dev
in my layouts/app:
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ config('app.name', 'Laravel') }}</title>
<!-- Fonts -->
<link rel="stylesheet" href="https://fonts.bunny.net/css2?family=Nunito:wght@400;600;700&display=swap">
<!-- Scripts -->
@vite(['resources/css/app.css', 'resources/js/app.js'])
<!-- Styles -->
@livewireStyles
</head>
<body class="font-sans antialiased">
<x-jet-banner />
<div class="min-h-screen bg-gray-100">
@livewire('navigation-menu')
<!-- Page Heading -->
@if (isset($header))
<header class="bg-white shadow">
<div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8">
{{ $header }}
</div>
</header>
@endif
<!-- Page Content -->
<main>
{{ $slot }}
</main>
</div>
@stack('modals')
@livewireScripts
@livewireMapsScripts()
</body>
</html>
in another view I put your component:
<livewire:map-view center-lat="52.004021" center-lng="7.710472" zoom="3" style="100vh" />
also tried as you put it:
<div style="height: 100vh; width: 100vw">
<livewire:map-view />
</div>
my browser console:
any clue what it could be?
Regards
Hmm, the browser console looks good. Did you compile the resources with e.g. does my sample app work for you?npm run dev
? If so,
Erik
its happens when you use alpinejs that is comon to have together with livewire
Ok, that's possible. Do you know if there is a general problem with Alpine + GMaps, or is it specific to this package? This package was kind of a proof of concept for me, but I'll look into it, also in light of the fact that Alpine may become a core dependency of the upcoming LWv3
Maybe you will need to load the gmaps with alpine js instead of native js
Hello! I followed the steps you indicate for Installation and Usage but the map is not displayed. I have already tried with 2 api keys and nothing, and it is not the api key because I am using one of them in another project and it works. What can be?
I'm using in my local project: "php": "^8.0.2", "laravel/framework": "^9.19", "laravel/jetstream": "^2.12", "livewire/livewire": "^2.5",