-
Notifications
You must be signed in to change notification settings - Fork 25
/
App.vue
129 lines (125 loc) · 2.64 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<template>
<div style="height: 75vh; width: 50vw;">
<l-map
v-model="zoom"
v-model:zoom="zoom"
:center="[47.41322, -1.219482]"
@move="log('move')"
>
<l-tile-layer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
></l-tile-layer>
<l-control-layers />
<l-marker :lat-lng="[0, 0]" draggable @moveend="log('moveend')">
<l-tooltip>
lol
</l-tooltip>
</l-marker>
<l-marker :lat-lng="[47.41322, -1.219482]">
<l-icon :icon-url="iconUrl" :icon-size="iconSize" />
</l-marker>
<l-marker :lat-lng="[50, 50]" draggable @moveend="log('moveend')">
<l-popup>
lol
</l-popup>
</l-marker>
<l-polyline
:lat-lngs="[
[47.334852, -1.509485],
[47.342596, -1.328731],
[47.241487, -1.190568],
[47.234787, -1.358337],
]"
color="green"
></l-polyline>
<l-polygon
:lat-lngs="[
[46.334852, -1.509485],
[46.342596, -1.328731],
[46.241487, -1.190568],
[46.234787, -1.358337],
]"
color="#41b782"
:fill="true"
:fillOpacity="0.5"
fillColor="#41b782"
/>
<l-rectangle
:lat-lngs="[
[46.334852, -1.509485],
[46.342596, -1.328731],
[46.241487, -1.190568],
[46.234787, -1.358337],
]"
:fill="true"
color="#35495d"
/>
<l-rectangle
:bounds="[
[46.334852, -1.190568],
[46.241487, -1.090357],
]"
>
<l-popup>
lol
</l-popup>
</l-rectangle>
</l-map>
<button @click="changeIcon">New kitten icon</button>
</div>
</template>
<script>
import {
LMap,
LIcon,
LTileLayer,
LMarker,
LControlLayers,
LTooltip,
LPopup,
LPolyline,
LPolygon,
LRectangle,
} from "@vue-leaflet/vue-leaflet";
import "leaflet/dist/leaflet.css";
export default {
components: {
LMap,
LIcon,
LTileLayer,
LMarker,
LControlLayers,
LTooltip,
LPopup,
LPolyline,
LPolygon,
LRectangle,
},
data() {
return {
zoom: 2,
iconWidth: 25,
iconHeight: 40,
};
},
computed: {
iconUrl() {
return `https://placekitten.com/${this.iconWidth}/${this.iconHeight}`;
},
iconSize() {
return [this.iconWidth, this.iconHeight];
},
},
methods: {
log(a) {
console.log(a);
},
changeIcon() {
this.iconWidth += 2;
if (this.iconWidth > this.iconHeight) {
this.iconWidth = Math.floor(this.iconHeight / 2);
}
},
},
};
</script>