adrema/resources/js/views/member/boxes/Vmap.vue

44 lines
1.2 KiB
Vue
Raw Normal View History

2022-11-22 01:55:57 +01:00
<template>
2023-05-16 17:19:56 +02:00
<l-map style="height: 100%" :zoom="zoom" :center="center">
<l-tile-layer :url="url" :attribution="attribution"></l-tile-layer>
<l-marker :lat-lng="markerLatLng"></l-marker>
</l-map>
2022-11-22 01:55:57 +01:00
</template>
<script>
2023-05-16 17:19:56 +02:00
import {LMap, LTileLayer, LMarker} from 'vue2-leaflet';
import {Icon} from 'leaflet';
delete Icon.Default.prototype._getIconUrl;
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'),
});
2022-11-22 01:55:57 +01:00
export default {
props: {
2023-05-16 17:19:56 +02:00
value: {
required: true,
validator(f) {
return f.length === 2;
},
},
},
components: {
LMap,
LTileLayer,
LMarker,
},
data() {
return {
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
attribution: '&copy; <a target="_blank" href="http://osm.org/copyright">OpenStreetMap</a> contributors',
zoom: 15,
center: [...this.value],
markerLatLng: [...this.value],
};
2022-11-22 01:55:57 +01:00
},
};
</script>