This commit is contained in:
2021-09-06 15:50:36 +02:00
parent c205e8bf23
commit 7545c4ffc9
7 changed files with 183 additions and 76 deletions

View File

@@ -1,22 +1,20 @@
<template>
<div :style="{'height': field.map.height}">
<div :style="{ height: field.map.height }">
<l-map
style="z-index:0"
style="z-index: 0"
:zoom="field.map.zoom"
:center="center"
:bounds="bounds"
@click="onMapClick"
>
<l-tile-layer
:url="url"
:attribution="attribution"/>
>
<l-tile-layer :url="url" :attribution="attribution" />
<slot></slot>
</l-map>
</div>
</template>
<script>
import {LMap, LTileLayer} from 'vue2-leaflet'
import { LMap, LTileLayer } from "vue2-leaflet";
export default {
props: {
@@ -36,24 +34,25 @@ export default {
data() {
return {
attribution: '&copy; <a target="_blank" href="http://osm.org/copyright">OpenStreetMap</a> contributors',
url: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
}
attribution:
'&copy; <a target="_blank" href="http://osm.org/copyright">OpenStreetMap</a> contributors',
url: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
};
},
methods: {
onMapClick(evt) {
this.$emit('click', evt);
}
this.$emit("click", evt);
},
},
components: {
LMap,
LTileLayer,
}
}
},
};
</script>
<style scoped>
@import "../../../node_modules/leaflet/dist/leaflet.css"
@import "../../../node_modules/leaflet/dist/leaflet.css";
</style>