Map.vue 582 B

12345678910111213141516171819202122232425262728
  1. <template>
  2. <div id="map" style="height: 500px" />
  3. </template>
  4. <script setup lang="ts">
  5. import L from "leaflet";
  6. import "leaflet/dist/leaflet.css";
  7. onMounted(() => {
  8. const map = L.map("map").setView([46.075245, 6.570162], 16);
  9. L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
  10. maxZoom: 19,
  11. attribution: "© OpenStreetMap contributors",
  12. }).addTo(map);
  13. const marker = L.marker([46.075245, 6.570162]).addTo(map);
  14. });
  15. </script>
  16. <style scoped lang="scss">
  17. #map {
  18. height: 100%;
  19. width: 70%;
  20. margin-left: auto;
  21. margin-right: auto;
  22. }
  23. </style>