我使用Vue2Leaflet 和Leaflet-semicircle。我在使用Vue2Leaflet时没有问题,但是我不知道如何在我的VueJS项目中使用Leaflet-semicircle。
<script>
import { latLng } from "leaflet";
import { LMap, LTileLayer, LMarker, LCircleMarker, LPopup, LTooltip } from "vue2-leaflet";
import { mapGetters } from 'vuex';
import moment from 'moment';
import 'leaflet-semicircle';
export default {
name: 'Map',
components: { LMap, LTileLayer, LMarker, LCircleMarker, LPopup, LTooltip, LSemicircle },
data() {
return {
map: null,
zoom: 12,
center: latLng(53.88694, 27.554572),
url: 'http://192.168.1.1/osm-tiles/{z}/{x}/{y}.png',
withPopup: latLng(53.88694, 27.524572),
withTooltip: latLng(53.88694, 27.565572),
currentZoom: 12,
currentCenter: latLng(53.88694, 27.554572),
showParagraph: false,
mapOptions: {
zoomSnap: 0.5
},
showMap: true
};
},
mounted() {
this.map = this.$refs.map.mapObject;
this.$nextTick(() => {
this.map = this.$refs.map.mapObject;
});
},
updated() {
L.semiCircle(latLng(53.88694, 27.554572), { // not working
radius: 5000,
startAngle: 45,
stopAngle: 360
}).addTo(this.map);
},
computed: {
...mapGetters('targetControl', { events: 'getEvents'}),
},
...
...
}
</script>