Not fully rendering Map and markers
See original GitHub issueHave the problem with map: not fully rendering Map.
My application work using vuejs-templates and vue-loader. And I found some problem with webpack and Vue2Leaflet, after that I add to my main.js next lines:
import L from 'leaflet';
delete L.Icon.Default.prototype._getIconUrl;
L.Icon.Default.mergeOptions({
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
iconUrl: require('leaflet/dist/images/marker-icon.png'),
shadowUrl: require('leaflet/dist/images/marker-shadow.png')
});
And after that, I have the same issue.
My component:
<template>
<div>
<l-map style="height: 90%" :zoom="zoom" :center="center">
<l-tile-layer :url="url" :attribution="attribution"></l-tile-layer>
<l-marker :lat-lng="marker"></l-marker>
</l-map>
</div>
</template>
<script>
import { LMap, LTileLayer, LMarker } from 'vue2-leaflet';
export default {
name: 'example',
components: {
LMap,
LTileLayer,
LMarker
},
data () {
return {
zoom:13,
center: L.latLng(47.413220, -1.219482),
url:'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
attribution:'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
marker: L.latLng(47.413220, -1.219482),
}
},
methods: {
mounted() {
setTimeout(function() { window.dispatchEvent(new Event('resize')) }, 250);
}
}
}
</script>
Result rendering map:

Question:
How it fix? @KoRiGaN do you have any ideas?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:25 (3 by maintainers)
Top Results From Across the Web
Marker component not rendering markers when using .map ...
I am trying to render markers for some various longitudes and latitudes on my map and for some reason, when the app loads,...
Read more >LWC Map markers not rendering - Salesforce Stack Exchange
I am creating a component that displays the current users accounts on a map. The map markers are not displaying. Am I overlooking...
Read more >Map markers not rendering [#1990048] | Drupal.org
I installed Drupal 6.28 and Gmap 6.x-2.0-beta2 last night. First problem was my map not rendering at all, so I searched existing issues, ......
Read more >Adding a Map and Markers to a React Application
This tutorial shows you how to add a Map and Marker to a React ... Note: The above snippets will render a blank...
Read more >google-map-react - npm
Additionally, it can render map components in the browser even if the Google Maps API is not loaded. It uses an internal, tweakable...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ximet I added
import "leaflet/dist/leaflet.css";
to my main.js ,then solved it.Hi @ximet,
You need to import the css from leaflet into your project.
Hope this helps,
Mickaël