I am making a vue project and I want to use leaflet inside of my components.
import L from 'leaflet';
export default {
created() {
L.map('map').setView([33.4501001, -101.9107704], 4); // Coordinates, Zoom
},
};
html:
<template lang="html">
<div class="row">
<div>
<h1> Hello </h1>
</div>
<div id="map">
</div>
</div>
</template>
But I get the error Map container not found
?
Best Answer
vue2-leaflet provides Vue2 leaflet components so you can do things like
<l-map ...><l-tile-layer ...>...</l-tile-layer></l-map>
.Here's the GitHub Repo.