gpt4 book ai didi

javascript - 如何在 VueJS 项目中将 leaflet-semicircle 与 vue2-leaflet 一起使用?

转载 作者:行者123 更新时间:2023-11-30 23:56:30 29 4
gpt4 key购买 nike

我使用Vue2LeafletLeaflet-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>

最佳答案

我解决了这个问题:

import L from "leaflet";
import 'leaflet-semicircle';

latLng changed by L.latLng

我只是没有传单上的 L 功能

关于javascript - 如何在 VueJS 项目中将 leaflet-semicircle 与 vue2-leaflet 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61015057/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com