I'm using Leaflet 1.3.1, to show a map on a blog made with Laravel and Vue.js
But the screen appears in gray. Although the markers, and the controls do appear.
And when I click on Inspect Elements, and I go to the layer, I see that it loads the .png of the world map. That is, by clicking on them, the Tile or Png of that particular square of the map will mutate.
This is my code:
layout / app.blade.php
..../
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" />
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="js/map/Leaflet.CountrySelect.js"></script>
/.....
Home.blade.php
extends('layouts.app')
@section('content')
<style>
.leatfet-container img{
min-height: none;
min-width:none;
}
</style>
<div id="map" style="width:100%;height:700px"></div>
<script>
var baseLayer = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',{attribution: 'Tiles © CartoDB'});
var map = L.map("map",{layers: [baseLayer], trackResize: false, center: [0.00, 0.00], zoom: 4});
var select = L.countrySelect({exclude:"French Southern and Antarctic Lands"});
select.addTo(map);
select.on('change', function(e){
if (e.feature === undefined){ //Do nothing on title
return;
}
var country = L.geoJson(e.feature);
if (this.previousCountry != null){
map.removeLayer(this.previousCountry);
}
this.previousCountry = country;
map.addLayer(country);
map.fitBounds(country.getBounds());
});
</script>
@foreach($articles as $article)
<script>
var ltd = {{$article->longitude}};
var lng = {{$article->latitude}};
L.marker([ltd, lng]).addTo(map)
.bindPopup("{{ $article->title }}").openPopup();
</script>
@endforeach
@endsection